How to give the outputfile name same as input file name.



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

How to give the outputfile name same as input file name.

Postby mathew28 » Mon Mar 19, 2012 8:04 pm

Hi,

I have jcl, which gets the input file through ftp.
Say, XXXX.INPUT.QC1234

I do some processing like SORT, execute an SQL etc.

Create the Output file with the results.
I have to name the output file having the last qualifiler of the input file during runtime
like
XXXX.OUTPUT.QC1234

is this possible ? Can we make use of symbolics ?

Please advice.
mathew28
 
Posts: 30
Joined: Tue Oct 20, 2009 11:06 am
Has thanked: 0 time
Been thanked: 0 time

Re: How to give the outputfile name same as input file name.

Postby Robert Sample » Mon Mar 19, 2012 8:13 pm

Symbolics would not help you. Once the job has been submitted, it goes through the converter / interpreter of JES. After that time, the JCL cannot be changed -- PERIOD. Therefore, your symbolic would have to be populated with the desired value BEFORE you submit the job; if the input file name comes from a step while the job is running, then you cannot do it with a single job. You MIGHT be able to split your processing into two jobs and set the value of the symbolic for the second job - but that would depend upon your site standards and what, precisely, you're trying to do.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: How to give the outputfile name same as input file name.

Postby mathew28 » Mon Mar 19, 2012 8:56 pm

I will put it more clearly

//step01 exec pgm=ftp
//ftp dd dsn=XXXX.INPUT.&FNAME {XXXX.INPUT.QC1234 }
// DISP=(NEW,CATLG, DELETE),...
//SYSPRINT DD SYSOUT =*
//SYSIN DD *
GET CV/TEST/QC1234.TXT //* <!-- I want this name to come in the last qualifier to the input file or move it to a symbolic so that i can reuse it. SET FNAME=QC1234
QUIT
//step02 exec pgm=sort
//sortin dd dsn=XXXX.INPUT.&FNAME {XXXX.INPUT.QC1234 }
//sortout dd dsn=XXXX.OUTPUT.&FNAME {XXXX.OUTPUT.QC1234 }

IF this is possible . Please help.
Thanks in advance
mathew28
 
Posts: 30
Joined: Tue Oct 20, 2009 11:06 am
Has thanked: 0 time
Been thanked: 0 time

Re: How to give the outputfile name same as input file name.

Postby BillyBoyo » Mon Mar 19, 2012 9:28 pm

For your JCL, at a very quick look, what you want to do can be accomplished with symbols. Problem is, your ftp control cards are not JCL. Unless you are on z/OS 1.13, you can't have symbolics in a stream of data.

You can generate the FTP control cards, for instance from DFSORT using JPn to allow the parameterisation.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: How to give the outputfile name same as input file name.

Postby MrSpock » Mon Mar 19, 2012 9:55 pm

mathew28, what you posted, if I understand it correctly, should theoretically work. What's the problem?

//*                                                                 
// SET FNAME=QC1234                                                 
//*                                                                 
//STEP01   EXEC PGM=FTP                                             
//FTP      DD   DSN=XXXX.INPUT.&FNAME,                               
//         DISP=(,CATLG,DELETE),...                                 
//OUTPUT   DD   SYSOUT =*                                           
//INPUT    DD   *                                                   
GET CV/TEST/QC1234.TXT //DD:FTP                                     
QUIT                                                                 
//*                                                                 
//STEP02   EXEC PGM=SORT                                             
//SORTIN   DD   DSN=XXXX.INPUT.&FNAME,...                           
//SORTOUT  DD   DSN=XXXX.OUTPUT.&FNAME,...                           
//*                                                                 
User avatar
MrSpock
Global moderator
 
Posts: 807
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 4 times

Re: How to give the outputfile name same as input file name.

Postby BillyBoyo » Mon Mar 19, 2012 10:04 pm

Whoops. I assumed you were using the symbolic in the control cards....
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: How to give the outputfile name same as input file name.

Postby BillyBoyo » Mon Mar 19, 2012 10:22 pm

mathew28 wrote:Hi,

I have jcl, which gets the input file through ftp.
Say, XXXX.INPUT.QC1234

I do some processing like SORT, execute an SQL etc.

Create the Output file with the results.
I have to name the output file having the last qualifiler of the input file during runtime
like
XXXX.OUTPUT.QC1234

is this possible ? Can we make use of symbolics ?

Please advice.


Looking more closely :-) I see you do have some idea related to the ftp control cards.

Do you, want to generate the input dsn name, output dsn name and control cards, all with the same parameter?

Or, do you want to know the file name that you are receiving and use that to create the dsns?

Or something else?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: How to give the outputfile name same as input file name.

Postby mathew28 » Mon Mar 19, 2012 11:41 pm

Thanks Billy and MrSpock for your replies.

Billly, I'm trying to figure out possible ways to find a solution to my requirement.

It is basically the combination of your first two questions.

An input file will be ftped. And I don't know the file name. The filename has a fixed pattern say. "QC1234_031912.TXT" and it varies each day.

I have to extract only a part of the ftp file i.e QC1234 and name it along with my output filename.
So, as you said, i need to use the file name that i'm receiving to create the dsns, output in particular. I think input file name doesn't make any difference.
So, the ftp file name should be there in the output filename.

I'm also analysing the possibility, if I give the first record as QC1234 in the input ftp file and then use it to extract it to a Symbolic using DFSORT or any other utility and then use it to name the output file.

Please advice. Thanks
mathew28
 
Posts: 30
Joined: Tue Oct 20, 2009 11:06 am
Has thanked: 0 time
Been thanked: 0 time

Re: How to give the outputfile name same as input file name.

Postby Robert Sample » Tue Mar 20, 2012 2:24 am

I'm also analysing the possibility, if I give the first record as QC1234 in the input ftp file and then use it to extract it to a Symbolic using DFSORT or any other utility and then use it to name the output file.
Extract the file name, and use it as part of a new job that you submit into the internal reader to be executed. That is the ONLY way to accomplish this task. Once your original job has started execution, you CANNOT create a new symbolic to be used by that selfsame job -- period. You can submit another job (via the internal reader of JES) that can contain the symbolic, but the currently executing job cannot access that value.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post