IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Replace one file content with another file content


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ansnero

New User


Joined: 26 May 2006
Posts: 13

PostPosted: Wed May 13, 2009 7:26 pm
Reply with quote

Hi,
I have two files

File1 which is of length 80 and FB as shown below
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
64450Q                  NNNNN011001200904                                     
417AED                5 0000000000000000000..0000012000000550478...000000000000
5011FD         1DATE3445   300056070000   011000015C123456789012        DODGE
SDDSD6         122334455   300042182022   011220015C972112908989           MRS 
W020DK         223344556   300024826122   011002328C111298439898          SCORED
W 98098J       987987987   197898398989   097898989K097097809809        DKJHNKJL
S0889L         0DATE8009   787878978979   029874398O097809709780        JKHKJHKH
S09780         439870912   978971132343   0942687436517366576857        KHJJKHKJ


File2 which is of length 4 and FB which has one record which is the DATE value

Code:
----
0513



I want to create an output File 3 which will have the contents of the file1 except the
character 'DATE' on column position 17 is replaced by the contents of file 2

Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
64450Q                  NNNNN011001200904                                     
417AED                5 0000000000000000000..0000012000000550478...000000000000
5011FD         105133445   300056070000   011000015C123456789012        DODGE
SDDSD6         122334455   300042182022   011220015C972112908989           MRS 
W020DK         223344556   300024826122   011002328C111298439898          SCORED
W 98098J       987987987   197898398989   097898989K097097809809        DKJHNKJL
S0889L         005138009   787878978979   029874398O097809709780        JKHKJHKH
S09780         439870912   978971132343   0942687436517366576857        KHJJKHKJ

I guess SPLICE might work.. and I am not very good with SPLICE. Tried a few times
and I cant get it right... Is there a way someone can help me out


Thanks
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed May 13, 2009 8:40 pm
Reply with quote

You can use a DFSORT job like the following to do what you asked for:

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=... input file2 (FB/4)-has 1 record w/date
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
  INREC BUILD=(C'TDATE,''',1,4,C'''',80:X)
//S2    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=... input file1 (FB/80)
//SORTOUT DD DSN=...  output file (FB/80)
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=(17,4,CH,EQ,C'DATE'),
    OVERLAY=(17:TDATE))
/*
Back to top
View user's profile Send private message
ansnero

New User


Joined: 26 May 2006
Posts: 13

PostPosted: Fri May 15, 2009 2:00 am
Reply with quote

Thanks a lot Frank.. It works as expected...
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 2
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Replace each space in cobol string wi... COBOL Programming 3
Search our Forums:

Back to Top