Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 11 Fri Sep 22, 2017 11:35 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us