Page 1 of 1

Appending to the exsting record

PostPosted: Fri Jan 15, 2010 6:48 pm
by pady21907
Hello All,

I have a requirement as bellow -

1. file1 of 160 length
2. file2 of 7 length
3. file3 is required of 167 length
I have to append the record1 of file2 to the record1 of file1 i.e. the third file will have the record1 of file1 + record1 of file2
eg.

file1         
12345       
abcd         

file2
999   
xyz   


then file3 should be as below-

file3

12345          999
abcd           xyz


All thihs should be acheived through JCL/Sort.

Looking forward to your reply.

Re: Appending to the exsting record

PostPosted: Fri Jan 15, 2010 10:28 pm
by Frank Yaeger
If you have z/OS DFSORT V1R5 PTF UK51706 or z/OS DFSORT V1R10 PTF UK51707 (Nov, 2009), you can use a DFSORT JOINKEYS job like the following to do what you asked for. If you have DFSORT, but don't have the Nov, 2009 PTF, ask your System Programmer to install it (it's free).

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/160)
//IN2 DD DSN=...  input file2 (FB/7)
//SORTOUT DD DSN=...  output file (FB/167)
//SYSIN    DD    *
  JOINKEYS F1=IN1,FIELDS=(168,8,A),SORTED,NOSEQCK
  JOINKEYS F2=IN2,FIELDS=(8,8,A),SORTED,NOSEQCK
  REFORMAT FIELDS=(F1:1,160,F2:1,7)
  OPTION COPY
/*
//JNF1CNTL DD *
  INREC OVERLAY=(168:SEQNUM,8,ZD)
/*
//JNF2CNTL DD *
  INREC OVERLAY=(8:SEQNUM,8,ZD)
/*