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

How to increment sequence number in file name itself


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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: 2481
Location: @my desk

PostPosted: Tue Oct 07, 2008 8:36 pm
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Oct 07, 2008 8:54 pm
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
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: 1702
Location: Australia

PostPosted: Wed Oct 08, 2008 4:47 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top