Page 1 of 1

Insert Data in a particular record

PostPosted: Mon Jul 20, 2009 10:53 pm
by samurai007
Hi,

I have a PS file of LRECL=80, RECFM=FB and BLKSIZE=8000.
It looks like this :

******* ********************************************************
00100 .......................Data............................
00200 .......................Data............................
00300 .......................Data............................
00400 Number of records is :
00500 .......................Data............................
00600 .......................Data............................
******* ********************************************************


I need to insert the record count at the end of the 4th line. This record count is in another PS file, with the same LRECL, BLKSIZE and RECFM as above.


******* *****************************
00100 0000011425
******* *****************************


So, the final output file should like something like :

******* ********************************************************
00100 .......................Data............................
00200 .......................Data............................
00300 .......................Data............................
00400 Number of records is : 0000011425
00500 .......................Data............................
00600 .......................Data............................
******* ********************************************************

Any idea how this can be done using a JCL ???

Re: Insert Data in a particular record

PostPosted: Mon Jul 20, 2009 11:22 pm
by Frank Yaeger
Here's a DFSORT job that will do what I think you asked for:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
0000011425
/*
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
  INREC BUILD=(C'CT,''',1,10,C'''',80:X)
/*
//S2    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD *
.......................Data............................
.......................Data............................
.......................Data............................
Number of records is :
.......................Data............................
.......................Data............................
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=(1,9,CH,EQ,C'Number of'),
    OVERLAY=(24:CT))
/*