× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: Integrated File System
  • From: wcork@xxxxxxxxx
  • Date: Tue, 3 Feb 1998 13:58:57 -0600 (CST)

        In addition to my earlier post on the IFS here is some code used
along with the header file that I posted.  I ran out of time earlier to
include this with that post...

This file creates a file on the UNIX system over a mount using the OS/400 NFS...

D RC              S             10I 0                                   
                                               DIR/File Name 
D FileNam         S             50A   INZ('/qualcomm/test1')         
D FileNamP        S               *   INZ(%ADDR(FileNam))               
D FileDescr       S             10I 0                                   
                                                                        
D O_CREAT         S             10I 0 INZ(8)          Create File Code
D O_RDWR          S             10I 0 INZ(4)          Authorities on File
D O_TEXTDATA      S             10I 0 INZ(16777216)   Conversion to Ascii
D O_CODEPAGE      S             10I 0 INZ(8388608)                      
D Oflag           S             10I 0 INZ(0)          Field Sent

D Omode           S             10U 0 INZ(511)                          
                                                                        
D cp              S             10U 0 INZ(819)       ** This is the Code
Page of File** 
D ZeroBin         S              1A   INZ(*ALLX'00')                    
D NLZero          S              2A   INZ(X'1500')                      
                                                                        
D SI_Fmt          S             50A   INZ('\n')                         
D SI_FmtP         S               *   INZ(%ADDR(SI_Fmt))                
                                                                        
D SI_Msg          S             50A                                     
D SI_MsgP         S               *   INZ(%ADDR(SI_Msg))                
                                                                        
D Num_DS          DS                                                    
D Num_Hex                        4A   INZ(X'00000000')                  
D Num                           10I 0 OVERLAY(Num_Hex)                  
                                                                        
D Buf             S            100A                   ** This is Information
Sent **
D BufP            S               *   INZ(%ADDR(Buf))                   
D BufLen          S             10U 0                                   
                                                                        
D/copy IFSHEAD                                                         
                                                                       
    ** Create File Name String **
C                   EVAL      FileNam = %TRIM(FileNam) + ZeroBin       
                                                                       
C                   Z-add     O_CREAT       Oflag                      
C                   Add       O_RDWR        Oflag                      
C                   Add       O_CODEPAGE    Oflag                      

** This command opens the file and create it if it does not exist and
assigns code page C                   EVAL
FileDescr=open(FileNamP:Oflag:Omode:cp)  

** Print error if error in opening or creating file **
C                   IF        FileDescr = -1                           
C                   EVAL      RC = perror(FileNamP)                    
C                   Return                                             
C                   ENDIF                                              

** Close the File **
C                   EVAL      RC = close(FileDescr)                    

** Print Error if Error when closeing file **
C                   IF        RC = -1                                   
C                   EVAL      RC = perror(FileNamP)                     
C                   Return                                              
C                   ENDIF                                               

** Reopen file **  I was informed that I had to open file twice like this in
order for the conversion to ascii to take place.
C                   Z-Add     O_RDWR        Oflag                       
C                   Add       O_TEXTDATA    Oflag                       
C                   EVAL      FileDescr=open(FileNamP:Oflag)            

** Again print any errors **
C                   IF        FileDescr = -1                            
C                   EVAL      RC = perror(FileNamP)                     
C                   Return                                              
C                   ENDIF                                               

** Populate feild with information to write to file **
** HEX 25 if I remember right is Line Feed...**
C                   EVAL      Buf='This is a Test number 1' + X'25'     

** Write information to file **
C                   EVAL      RC = write(FileDescr: BufP: BufLen)       
                               
** Print any Errors                                         
C                   IF        RC = -1                                   
C                   EVAL      RC = perror(FileNamP)                     
C                   Return                                              
C                   ENDIF                                               
                                                                        
** Close the File **                                                       
C                   EVAL      RC = close(FileDescr)                     
                                                                        
C                   IF        FileDescr = -1                            
C                   EVAL      RC = perror(FileNamP)                     
C                   Return                                              
C                   ENDIF                                               
                                                                         
C                   SETON                                        LR     


I hope this will help in writing any program.  If you have any quesitons
please let me know. I also wrote a program that reads a directory on the
Unix box and looks for a paticular file.  If it finds the file it opens and
reads the file then moves it or deletes it...  If you need help building a
header for a command I might be able to help out in that area as well.
Sometimes it get kinda confusing trying to translate the C header files over
to RPGIV format needed...

Hope this Helps,

Wayne Cork
Groendyke Transports, Inc.
Wcork@Ionet.net

+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to "MIDRANGE-L@midrange.com".
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.