Page 1 of 1

Change only first record and opy the rest

PostPosted: Thu Nov 11, 2010 12:22 am
by pucca71
Hi again.

This time I have to build a sortcard to read from a file and copy all records to another, but changing just first record, and copy the same equals:
Both files are FB.

From this:
********************************* Top of Data **********************************
//          DD DISP=SHR,DSN=CIPORIN.D10313.T112340.IMAGE                       
//          DD DISP=SHR,DSN=CIPORIN.D10313.T553450.IMAGE                       
//          DD DISP=SHR,DSN=CIPORIN.D10313.T773453.IMAGE                       
******************************** Bottom of Data ********************************

To this:

********************************* Top of Data **********************************
//SORTIN    DD DISP=SHR,DSN=CIPORIN.D10313.T112340.IMAGE                       
//          DD DISP=SHR,DSN=CIPORIN.D10313.T553450.IMAGE                       
//          DD DISP=SHR,DSN=CIPORIN.D10313.T773453.IMAGE                       
******************************** Bottom of Data ********************************


This way I am building a member that will be included in another sort step.

I will appreciatte your help as usual! ;)

Re: Change only first record and opy the rest

PostPosted: Thu Nov 11, 2010 5:33 am
by skolusu
pucca71,

Use the following DFSORT JCL which will give you the desired results. I assumed that your input is FB recfm and LRECL of 80
//STEP0100 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD DATA,DLM=$$                                       
//         DD DISP=SHR,DSN=CIPORIN.D10313.T112340.IMAGE         
//         DD DISP=SHR,DSN=CIPORIN.D10313.T553450.IMAGE         
//         DD DISP=SHR,DSN=CIPORIN.D10313.T773453.IMAGE         
$$                                                             
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD *                                                 
  SORT FIELDS=COPY                                             
  INREC IFOUTLEN=80,IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,3,ZD)),
  IFTHEN=(WHEN=(81,3,ZD,EQ,1),OVERLAY=(3:C'SORTIN'))           
//*

Re: Change only first record and opy the rest

PostPosted: Thu Nov 11, 2010 5:59 am
by pucca71
Thanks Skolusu !!

I will try your suggested solution and let you know the results.

Thanks again. ;)

Re: Change only first record and copy the rest

PostPosted: Thu Nov 11, 2010 6:07 am
by pucca71
Skosulu ! It worked perfectly !
Thanks a lot.
(BTW, we work for the same company ;) )