I need your views on a problem that I am facing.As per my project requirement I need to send a file to a partner.The partner wants the file name in the format AEPAC01P.001.I am not aware of any method by which I can read the seq number from any sequential/VSAM file and use that seq number to add that at the end of AEPAC01P..I need to update the seq number(by adding one to the existing one) in the sequensial/VSAM file after the every successfull run so that next time I get the next seq no.
I am giving my transmission card below and hilighting the change required in red.The number shown in red(001) is currently a static one.Instead of this we require a number that will be read from a file and used here.After completion we will require to update the file number by adding one for next run.Please responsd as this is very urgent requirement.
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
Pranta,
Which SORT product are you using? I believe you can do this using any of those.
If you know for sure that the file number is going to be incremented by '1', why do you need an additional file to store that value? Are you using that file anywhere else?
Have a flat file in your SYSIN having all the the contents in your //SYSIN DD * .... */. Include a previous step where u can get the sequence number from sequential/VSAM File and replace XXX with the sequnce number in &FILENAME=AEPAC01P.XXX - /* REMOTE FLE NAME */ using sort or a program.
The file is not going to be used by other process.But if we don't store the last transmitted sequence number in a file how will we come to know the current sequence number to be used?I don't think there is any method to get data from last transmition job.
Thanks for your response.But please let me know how to get the data from a seq file in in the prev step as you mentioned?Also how should I pass it to the file name in the XXX part?
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
pranta,
Quote:
I don't think there is any method to get data from last transmition job.
You can have the SYSIN control statements in a card and initialize the file number to '000' . For each run, put a sort step before this step to modify the card to add '1' to the file number and use the modified the card. You dont really need an additional file to achieve this.
In first sort step - get the sequence number from the input file and have it in a temp output file using outrec.. say output file created is &&temp1
Have ur SYSIN like this
//SYSIN D *
SORT FIELDS=COPY
OUTREC FIELDS=(1:C'SEQ,C',6:X'7D',7:1,3,10:X'7D')
(assuming first three position has ur sequence number in input file)
/*
The Second sort step, should be like this
//SORT2 EXEC PGM=SORT
//SYMNAMES DD DSN=&&temp1, DISP=SHR
//SORTIN DD * ...... (have ur SYSIN of DMBATCH here)
.
.
&FILENAME=AEPAC01P.XXX - /* REMOTE FLE NAME */
.
.
/*
//SORTOUT DD DSN=flat file (file to be used instead of ur SYSIN)
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1,19,20,3,CHANGE=(3,C'XXX',SEQ),NOMATCH=(20,3),23,58)
/*