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 increment sequence number in file name itself

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Ganesh N

New User


Joined: 09 May 2008
Posts: 7
Location: Kochi

PostPosted: Tue Oct 07, 2008 8:35 pm    Post subject: How to increment sequence number in file name itself
Reply with quote

Hi,

I found trouble in incrementing the sequence number which is being appended in the file name.
For first run the file name is AEBCQ01P.001 in JCL,but it should be as AEBCQ01P.002 for the 2nd run. This file name is specified in SYSIN card itself.

Please help to solve this issue.
Back to top
View user's profile Send private message

Arun Raj

Moderator


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

PostPosted: Tue Oct 07, 2008 8:36 pm    Post subject:
Reply with quote

Can you post the sample input and expected output?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8117
Location: East Dubuque, Illinois, USA

PostPosted: Tue Oct 07, 2008 8:54 pm    Post subject:
Reply with quote

1. AEBCQ01P.001 is not a valid file name in JCL -- every level must start with a letter or symbol, not a number.
2. What you want to do cannot be done through pure JCL -- you will need to write a program to submit your JCL to the internal reasder with the correct sequence number in the correct spot.
3. Why not just use a GDG which is already part of the system rather than reinvent the wheel?
Back to top
View user's profile Send private message
Ganesh N

New User


Joined: 09 May 2008
Posts: 7
Location: Kochi

PostPosted: Tue Oct 07, 2008 8:57 pm    Post subject: Reply to: How to increment sequence number in file name itse
Reply with quote

Hi,

My JCL is used to transmit the file to different location. I have coded as below
Code:

//STEP10   EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*   
//SORTOUT  DD SYSOUT=*   
//SORTIN   DD *                                                         
      &FROMDSN='PV1376A.GRAUD540.SEND -  /* LOCAL DATASET*/       
      &FDISP=DISP=(SHR) - /* FROM DISP */                               
      &FDCB=DCB=(DSORG=PS) - /* DCB INFO */                             
      &TDISP=NEW - /* TO DISP */                                       
      &FILENAME=AEBQC01P.001 - /* REMOTE FLE NAME */                   
/*                                                   
//SYSIN    DD *                                     
  OPTION COPY                                       
  INREC IFTHEN=(WHEN=(1,9,CH,EQ,C'&FILENAME'),       
        OVERLAY=(20:20,3,ZD,ADD,+1,ZDF,LENGTH=3))   
/*


In the above JCL, my aim is to increment the &Filename after each run. As
AEBQC01P.002 in the 2nd run, AEBQC01P.003 in 3rd and so on
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Wed Oct 08, 2008 4:47 am    Post subject:
Reply with quote

Hi,

In order to increment the run number, you will need to store the information in a file, I would then add a step to the job to increment the number like below
Code:
//S1       EXEC PGM=ICEMAN                                       
//SYSOUT   DD SYSOUT=*                                           
//SORTIN   DD *                                                 
&FILENAME=AEBQC01P.001 - /* REMOTE FLE NAME */                   
/*                                                               
//SORTOUT  DD DSN=OUTPUT-FILE                                   
//SYSIN    DD *                                                 
 OPTION COPY                                                     
  INREC OVERLAY=(20:20,3,ZD,ADD,+1,ZDF,LENGTH=3)                 


SORTIN DD * will need to be the OUTPUT-FILE (GDG files would very useful)

ie.

SORTIN DD DSN=FILE(0)
SORTOUT DD DSN=FILE(+1)



Now you can concatenate the (+1) FILE in your step.


Gerry
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
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
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm


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