Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: How to read a seq no from a file and add to a file name
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: 2284
Location: @my desk

PostPosted: Thu Aug 21, 2008 11:48 am    Post subject:
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    Post subject:
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    Post subject: Reply to: How to read a seq no from a file and add to a file
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    Post subject: Reply to: How to read a seq no from a file and add to a file
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: 2284
Location: @my desk

PostPosted: Thu Aug 21, 2008 12:09 pm    Post subject:
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    Post subject:
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: 2284
Location: @my desk

PostPosted: Thu Aug 21, 2008 12:33 pm    Post subject:
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    Post subject: Reply to: How to read a seq no from a file and add to a file
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SSH - known_hosts file configuration vasanthz All Other Mainframe Topics 2 Wed Jul 26, 2017 2:10 am
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us