Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Replace one file content with another file content

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Replace one file content with another file content
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 Moderator


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

PostPosted: Wed May 13, 2009 8:40 pm    Post subject:
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    Post subject: Reply to: Replace one file content with another file content
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us