systemappsprogram.blogspot.com

AS400 Easy way to Read File A to File B

FFilea            if   e           k disk   
Ffileb            uf a  e         k disk   

D ds_filea        E DS                  ExtName( Filea )
D ds_fileb        E DS                  ExtName( Fileb )
Image result for as400
read filea
dow not%eof(filea)

eval ds_fileb = ds_filea
eval random_number = random_number
write {fileb}
read  filea
enddo 

 // dump member names to outfile for processing                       
  runCmd( 'DSPFD FILE(LIB/FILEA) TYPE(*MBRLIST) OUTPUT(*OUTFILE) '
        + 'FILEATR(*ALL) OUTFILE(QTEMP/DUMPF)' );
FFilea            if   e           k disk     usropn
Ffileb            uf a  e         k disk   
D CmdString       s            256    inz(*blanks)
D CmdLength       s             15  5 inz(0)

D ds_filea        E DS                  ExtName( Filea ) 
D ds_fileb        E DS                  ExtName( Fileb ) 

C                   eval      CmdString = %trim('ovrdbf  filea  member(*ALL) ')
C                   eval      CmdLength = %len(%trim(CmdString))
C                   call(e)   'QCMDEXC'                           
C                   parm                    CmdString
C                   parm                    CmdLength

c                    if  not%open(filea)
c                    open filea
c                    endif

read filea 
dow not%eof(filea)

eval ds_fileb = ds_filea
eval random_number = random_number
write {fileb}
read  filea
enddo 
Share:

No comments:

Translate

Popular Posts

Recent Posts

Support System Software

Customer support is usually one of the key aspects for all companies, both small and large enterprises. Having a reliable customer support system will result in a positive image of your brand and will be a clear sing that you actually care about your clients and put effort into keeping them satisfied. Our team of SaaS experts have collected and tested all popular customer support software services currently available in the market. Our list should allow you to more easily decide which solution will work best for your business. Need our help to upload or customize this blogger template? Contact me with details about the theme customization you need.