View previous topic :: View next topic
Author
Message
hiravibk Warnings : 1 Active User Joined: 14 Dec 2008Posts: 107 Location: India
Hi,
I am trying to achieve the following:
Requirement:
1) Account number(key) on FILE1 is ZD at position 5. Length is 15. LRECL is 19. FILE1 is just a lookup file.
2) Account number(key) on FILE2 is PD at position 550. Length is 15. LRECL is 634
3) Output i need is:
A) FILE2 should be overlayed with 'AB' at position 582 for accounts present in FILE1. For accounts present in FILE2 but not in FILE1, the records are untouched in FILE2.
What i tried:
Code:
//STEP075 EXEC PGM=ICETOOL
//IN1 DD *
371262133046000
123456789123456
/*
//IN2 DD DSN=...
//T1 DD DSN=..., DISP=(MOD,PASS)
//OUT13 DD DSN= BOTH,
//OUT3 DD DSN=F2ONLY
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT13) ON(550,15,PD) WITH(646,1) -
USING(CTL3) KEEPNODUPS
/*
//CTL1CNTL DD *
INREC OVERLAY=(550:5,15,645:C'11')
/*
//CTL2CNTL DD *
INREC OVERLAY=(645:C'33')
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT13,INCLUDE=(645,2,CH,EQ,C'13'),BUILD=(1,581,C'AB',584,50)
OUTFIL FNAMES=OUT3,INCLUDE=(645,2,CH,EQ,C'33'),BUILD=(1,634)
/*
Appreciate any help. Thanks!
Back to top
RahulG31 Active User Joined: 20 Dec 2014Posts: 446 Location: USA
Why not using JOINKEYS with JNFnCNTL ?
.
Back to top
kranthikumarb Active User Joined: 02 Jan 2009Posts: 115 Location: Hyderabad
Try this
Code:
//SORTKK EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//FILE1 DD DISP=SHR,DSN=<file1 recl 19 FB>
//FILE2 DD DISP=SHR,DSN=<file2 recl 634 FB>
//SORTOUT DD SYSOUT=*
//MATCH DD SYSOUT=*
//JNF2CNTL DD *
INREC OVERLAY=(635:550,8,PD,TO=ZDF,LENGTH=15)
//SYSIN DD *
JOINKEYS F1=FILE1,FIELDS=(5,15,A)
JOINKEYS F2=FILE2,FIELDS=(635,15,A)
JOIN UNPAIRED,F2
REFORMAT FIELDS=(F2:1,634,?)
OPTION COPY
INREC IFTHEN=(WHEN=(635,1,CH,EQ,C'B'),OVERLAY=(582:C'AB'))
OUTFIL FNAMES=FILE2,BUILD=(1,634)
/*
Back to top
Please enable JavaScript!