IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to read a seq no from a file and add to a file name


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
pranta

New User


Joined: 23 Feb 2006
Posts: 16

PostPosted: Thu Aug 21, 2008 11:21 am
Reply with quote

Hi All,

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.

//DMBATCH EXEC PGM=DMBATCH,
// PARM=(YYSLYNN),
// REGION=1024K
//*
//DMNETMAP DD DSN=SYSS.NDM.NETMAP,
// DISP=SHR
//*
//DMPUBLIB DD DSN=XX99P.CD390.PROCESS.LIB.TMBLWEED,
// DISP=SHR
//*
//DMMSGFIL DD DSN=SYSS.NDM.MSG,
// DISP=SHR
//*
//APITRACE DD SYSOUT=*
//APISECUR DD SYSOUT=*
//DMPRINT DD SYSOUT=*
//NDMCMDS DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//*
//**********************************************************************
//* &SNODE = THE NODE RECEIVING THE TRANSMISSION. *
//* &FROMDSN = THE LOCAL DATASET. *
//* &FILENAME = THE REMOTE FILE NAME. *
//* &USERID = THE REMOTE USERID AND PASSWORD. *
//**********************************************************************
//*
//SYSIN DD *
SIGNON -
ESF=YES
SUBMIT PROC=STDPROC -
NEWNAME=SFTPROC -
&SNODE=SFTCDPRD -
CASE=YES -
&USERID=AMXLMRPRD - /* REMOTE USER ID */
&TRANID=00000003733 -
&FROMDSN='PV1376A.TO.QANTAS.A10.DATA.AU, - /* LOCAL DATASET */
&FDISP=DISP=(SHR) - /* FROM DISP */
&FDCB=DCB=(DSORG=PS) - /* DCB INFO */
&TDISP=NEW - /* TO DISP */
&FILENAME=AEPAC01P.001 - /* REMOTE FLE NAME */
&TDATTYP=TEXT -
&TXLATE=YES -
&TSTRIP=NO -
&TPIPE=NO -
&TXLATBL=, -
&CKPT=100M -
&COMPRESS='COMPRESS EXT'
SIGNOFF
/*
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu Aug 21, 2008 11:48 am
Reply with quote

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?

Thanks,
Arun
Back to top
View user's profile Send private message
jsathishbabu84

New User


Joined: 07 Jun 2007
Posts: 22
Location: India

PostPosted: Thu Aug 21, 2008 11:51 am
Reply with quote

Hi Pranta,

Try this out..

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.

Regards,
SJ
Back to top
View user's profile Send private message
pranta

New User


Joined: 23 Feb 2006
Posts: 16

PostPosted: Thu Aug 21, 2008 11:56 am
Reply with quote

Hi Arun,

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,
Pranta
Back to top
View user's profile Send private message
pranta

New User


Joined: 23 Feb 2006
Posts: 16

PostPosted: Thu Aug 21, 2008 12:02 pm
Reply with quote

Hi jsathishbabu84,

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?

Thanks,
Pranta
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu Aug 21, 2008 12:09 pm
Reply with quote

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.

Thanks,
Arun
Back to top
View user's profile Send private message
jsathishbabu84

New User


Joined: 07 Jun 2007
Posts: 22
Location: India

PostPosted: Thu Aug 21, 2008 12:23 pm
Reply with quote

Pranta,

This can be done with two sort steps..

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)
/*

Regards,
SJ
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu Aug 21, 2008 12:33 pm
Reply with quote

Hi Pranta,

Here's a SORT job which updates the card everytime by incrementing it by 1. I have assumed '&FILENAME' in pos 1-9 to identify the line.

Remember, once the file-number reaches 999, it will start with 000 again as you have chosen a 3 digit number.

Code:
//STEP00   EXEC PGM=SORT                                     
//SYSOUT   DD SYSOUT=*                                       
//SORTOUT  DD SYSOUT=*                                       
//SORTIN   DD *                                               
SIGNON -                                                     
ESF=YES                                                       
SUBMIT PROC=STDPROC -                                         
NEWNAME=SFTPROC -                                             
&SNODE=SFTCDPRD -                                             
CASE=YES -                                                   
&USERID=AMXLMRPRD - /* REMOTE USER ID */                     
&TRANID=00000003733 -                                         
&FROMDSN='PV1376A.TO.QANTAS.A10.DATA.AU, - /* LOCAL DATASET */
&FDISP=DISP=(SHR) - /* FROM DISP */                           
&FDCB=DCB=(DSORG=PS) - /* DCB INFO */                         
&TDISP=NEW - /* TO DISP */                                   
&FILENAME=AEPAC01P.000 - /* REMOTE FLE NAME */               
&TDATTYP=TEXT -                                               
&TXLATE=YES -                                                 
&TSTRIP=NO -                                                 
&TPIPE=NO -                                                   
&TXLATBL=, -                                                 
&CKPT=100M -                                     
&COMPRESS='COMPRESS EXT'                         
SIGNOFF                                         
//SYSIN    DD *                                 
  OPTION COPY                                   
  INREC IFTHEN=(WHEN=(1,9,CH,EQ,C'&FILENAME'),   
        OVERLAY=(20:20,3,ZD,ADD,+1,ZDF,LENGTH=3))


SORTOUT
Code:
SIGNON -                                                     
ESF=YES                                                       
SUBMIT PROC=STDPROC -                                         
NEWNAME=SFTPROC -                                             
&SNODE=SFTCDPRD -                                             
CASE=YES -                                                   
&USERID=AMXLMRPRD - /* REMOTE USER ID */                     
&TRANID=00000003733 -                                         
&FROMDSN='PV1376A.TO.QANTAS.A10.DATA.AU, - /* LOCAL DATASET */
&FDISP=DISP=(SHR) - /* FROM DISP */                           
&FDCB=DCB=(DSORG=PS) - /* DCB INFO */                         
&TDISP=NEW - /* TO DISP */                                   
&FILENAME=AEPAC01P.001 - /* REMOTE FLE NAME */               
&TDATTYP=TEXT -                                               
&TXLATE=YES -                                                 
&TSTRIP=NO -                                                 
&TPIPE=NO -                                                   
&TXLATBL=, -                                                 
&CKPT=100M -                                                 
&COMPRESS='COMPRESS EXT'                                     
SIGNOFF                                                       


Thanks,
Arun
Back to top
View user's profile Send private message
pranta

New User


Joined: 23 Feb 2006
Posts: 16

PostPosted: Thu Aug 21, 2008 1:53 pm
Reply with quote

Hi all,

Thanks for ur replies.I will work on these line and will update you if any issue comes up.Thanks again for your help.

Thanks,
Pranta
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top