Page 1 of 1

file sequence number

PostPosted: Tue Aug 17, 2010 12:57 pm
by asvdeb
Hi All,

I need to add the sequence number of the file in my trailer record.

The trailer rec need to be formated as

"TR"number of records in this file, the file sequence number

the file seq number needs to contain the number of the file, that means

file seq num=1 for the first file
=2 for the second file
=3 for the third file and so on

the job will run in daily basis, so this file seq num have to increase in such a way so that

today's file seq num=yesterday's file seq num + 1

Can anybody please answer me , weather it is possible or not? If yes th

Re: file sequence number

PostPosted: Tue Aug 17, 2010 3:07 pm
by NicC
I would get the file creation program to do that. But if that is not possible I am sure you could use SORT. In either case you will need a new file to hold the last sequence number which would have to be updated by the process. I am nowhere near being an expert on sort - I can just about use it for sorting and selecting or selecting and sorting records. Generally for a SORT solution I know you will have to provide LRECL, RECFM of the file and the exact layout of the trailer record that you want created.

Re: file sequence number

PostPosted: Tue Aug 17, 2010 9:38 pm
by skolusu
asvdeb,

Here is an idea. This will increase the seqnum everytime it ran.

Create a 80 byte FB recfm format. It will have just 1 lines to begin with. Populate the above defined file with this

let us say this filename is userid.filenum

FILENUM,C'00000001'


Now run this job. I also assumed your input is also FB 80 bytes

//STEP0100 EXEC PGM=SORT                     
//SYSOUT   DD SYSOUT=*                       
//SYMNAMES DD DSN=userid.filenum,           
//            DISP=SHR                       
//SORTIN   DD DSN=your input FB 80 byte file,           
//            DISP=SHR                       
//FILECNT  DD DSN=userid.filenum,           
//            DISP=SHR                       
//SORTOUT  DD SYSOUT=*   
//SYSIN    DD *                               
  SORT FIELDS=COPY                                           
  OUTREC OVERLAY=(81:FILENUM,81,8,ZD,ADD,+1,M11,LENGTH=8)     

  OUTFIL REMOVECC,BUILD=(1,80),                               
  TRAILER1=(C'TR;',COUNT=(M11,LENGTH=8),';',FILENUM)         
                                                             
  OUTFIL FNAMES=FILECNT,REMOVECC,NODETAIL,BUILD=(1,80),       
  TRAILER1=(C'FILENUM,C''',89,8,'''',80:X)                   
//*                                           


After every run you will see the filenum being incremented.

Re: file sequence number

PostPosted: Wed Aug 18, 2010 2:09 pm
by asvdeb
Hi Skolusu,

Many thanks for your reply.

I ran the job with your suggested code. But the job did not run successfully.It is giving error message stating "ICE185A 0 AN S013 ABEND WAS ISSUED BY DFSORT, ANOTHER PROGRAM OR AN EXIT" .

I am searching for the error also, but could not get a solution for this.

Could you please tell me for what reason it is getting the error.

Thanks
asvdeb

Re: file sequence number

PostPosted: Wed Aug 18, 2010 5:32 pm
by NicC
You had better post your JCL as an 013 is generally a member of a PDS not found but Kolusu's code did not include a PDS. If you do not have a PDS in your JCL then you had better show the full error messages and not just the ones in the DFSORT SYSOUT but from the JES messages too.
This is misleading and should be ignored. The 013 is a OPEN error, but most likely has nothing to do with a pds.

Re: file sequence number

PostPosted: Wed Aug 18, 2010 10:05 pm
by skolusu
asvdeb,

An S013 is probably because you changed the LRECL/RECFM of the Symnames dataset. A SYMNAMES DD statement data set MUST have the following attributes: RECFM=F or RECFM=FB and LRECL=80.

Show us the complete sysout of the job.