Dynamic name allocation to a file

In this Mainframe Forum - You can post your queries on JCL, OS/390 JCL, MVS JCL, z/OS JCL, JES2 & JES3

Moderators: Frank Yaeger, DikDude, Moderator Group

Post Reply
Tejas
Member
Posts: 8
Joined: Fri Apr 13, 2007 3:23 pm

Dynamic name allocation to a file

Post by Tejas » Mon Jun 18, 2007 10:47 pm

Got a wierd problem.

Have a dataset ABC, which has the date parameter in the last fields (eg. 2007-06-18).

This dataset is to be FTPed to a server, into the destination path, and is to be renamed as ABC_last-date-parameters.dat. (eg. ABC_20070618.dat).

The naming/specification of the server/username-passwd and path etc happens in the FTP step itself.

Can this requirement be satisfied?

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Mon Jun 18, 2007 10:54 pm

you are not going to be able to generate a dataset name (DSN) that has as one of the nodes all numerics or > 8 length.

most people that use this date stuff in DSNs use .Y2007.MnnDnn
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

Tejas
Member
Posts: 8
Joined: Fri Apr 13, 2007 3:23 pm

Post by Tejas » Mon Jun 25, 2007 6:47 pm

agreed...

how abt the format being...

ABC_DCCYYMMDD.dat

where CCYYMMDD are the last column contents of the file.

Veera
Moderator
Posts: 111
Joined: Wed Feb 22, 2006 2:59 pm

Post by Veera » Sat Jul 14, 2007 1:06 am

Tejas i can give you some pointers on this..

Yes there is a way to achieve what you have asked for

Its a 2 step process

Code: Select all


STEP1 
********
Assume below is the FTP CARD in a dataset/sysin member

100.100.55.154                                    
username
pswd
TYPE A                                            
CD /                                              
CD TEST
PUT 'ABC.VEERA.EXTR.DATEQLFR' SAMPLE_&%@^#!.TXT
QUIT                                              

Now this file has to be fed to a COBOL pgm as input with first 3 bytes as key
and rest as one more field.

Now when the key = PUT read the record else skip all the other lines/records.

Now when we hit the record consider the rest of the record apart from the

key as a string, in a COBOL pgm use INSPECT string replacing by you DATEQLFR

or if the DATEQLFR is curr date get the curr date using some cobol function

move into a working storage variable and finally INSPECT STRING AND REPLACE

"&%@^#!" with the date.

Now the output of step1 will be the same FTP card as above except for the

change in the .TXT file with the date now.

Code: Select all


Sample Code for INSPECT
*******************************

MOVE WZ-999-CURRENT-DATE                  
  TO FTP-MMDDYY                           
INSPECT FTPIN-REC                         
        CONVERTING '&%@^#!' TO FTP-MMDDYY  -> Have ur desired value in FTP-MMDDYY
WRITE FTPOUT-REC FROM FTPIN-REC    


STEP2
********

Now feed the OUTPUT from the step1 as the ORIGINAL FTP CARD to a FTP
step.


We have done this and it works.

Well If you have any questions reg this let us know.

Thanks,
Veera.

Tejas
Member
Posts: 8
Joined: Fri Apr 13, 2007 3:23 pm

Post by Tejas » Sun Jul 15, 2007 11:37 am

Veera... you R-O-C-K !!!!!

udaya00
Member
Posts: 6
Joined: Wed Apr 08, 2009 9:46 am

Post by udaya00 » Mon May 11, 2009 5:24 pm

Hi all,
i required to change last qaulifier of dataset name with current date (Dmmddyy) automatically.
kindly help me.

thanks in advance,
uday

udaya00
Member
Posts: 6
Joined: Wed Apr 08, 2009 9:46 am

Post by udaya00 » Mon May 11, 2009 5:30 pm

Hi all,

i required to change last qaulifier of dataset name with current date (Dmmddyy) automatically in JCL.
Dataset is used as output file (not inside sysin).

JCL should not be changed everytime.

kindly help me.

thanks in advance,
uday

MrSpock
Active Member
Posts: 273
Joined: Wed Jun 27, 2007 5:37 pm

Post by MrSpock » Mon May 11, 2009 5:50 pm

udaya00 wrote:i required to change last qaulifier of dataset name with current date (Dmmddyy) automatically in JCL.
Normally you'd have your job scheduling system take care of this. Is that not possible?

User avatar
Natarajan
Moderator
Posts: 537
Joined: Fri Oct 10, 2008 12:57 pm
Location: chennai
Contact:

Post by Natarajan » Mon May 11, 2009 9:09 pm

check this thread
http://www.mainframegurukul.com/Mainfra ... php?t=3993

If you still have any issues, do let us know.
Natarajan
Chennai

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others