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

Writing the output file name from a parameter in the input


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
jaguyria

New User


Joined: 15 Feb 2022
Posts: 21
Location: Portugal

PostPosted: Fri Sep 02, 2022 5:41 pm
Reply with quote

Hello,

I need to create a step to transfer a cobol file throw CFT with a specific name.
The file transferred must be named with a Date IN (char(8) that is in the cobol file) and the timestamp of the transfer.
NB: The parameter Date is on the position 1 to 8 (2nd line) of F0.INPUT.FILE

I thought using de PROC=CFTREQB:
Code:
//ENV001    EXEC PROC=CFTREQB
//CFTIN       DD *
 SEND FNAME=F0.INPUT.FILE
 PART=TRF01,IDF=ABCDEF
 NFNAME=F0..&DATEIN..&FDATE..&FTIME
 FCODE=EBCDIC,
 NCODE=EBCDIC
/*


Regarding the manuals the parameters &FDATE, &FTIME must work using the NFNAME (https://docs.axway.com/bundle/TransferCFT_36_UsersGuide_allOS_en_HTML5/page/Content/CFTUTIL/Parameter_index/nfname.htm)

But how can I extract the date of the file into variable &DATEIN?
Does anyone have an idea?

Thanks in advance!
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4651
Location: Raleigh, NC, USA

PostPosted: Fri Sep 02, 2022 6:56 pm
Reply with quote

Easy, you'll need a step that runs prior to the CFT step that will read the input dataset (F0.INPUT.FILE) and extract the date value as required. It would then build the required NFNAME statement as needed, and then pass that to the input of the CFT step.
Back to top
View user's profile Send private message
jaguyria

New User


Joined: 15 Feb 2022
Posts: 21
Location: Portugal

PostPosted: Fri Sep 02, 2022 7:18 pm
Reply with quote

Can you please be more specific about the step?
How can I extract the date value so easily?
Back to top
View user's profile Send private message
jaguyria

New User


Joined: 15 Feb 2022
Posts: 21
Location: Portugal

PostPosted: Fri Sep 02, 2022 8:06 pm
Reply with quote

Hello superk,

Maybe I wasn't too clear.

I'll give you the following example:

In the input file (F0.INPUT.FILE) I have:
20220430blablabla
(...)

And I must generate the output dataset as
F0.20220430.20220902.1930
<=>
F0..&DATEIN..&FDATE..&FTIME

So I need to extract from the input file the date 20220430 into the exterior variable &DATEIN

How can I do it? Maybe is too easy for those who works with JCL daily (but it's not my case)..

Kind regards. Thanks for your time!
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 628
Location: Denmark

PostPosted: Fri Sep 02, 2022 8:46 pm
Reply with quote

You can't, JCL variables are substituted as part of the job initialization (except condcode vars of course).
This have discussed before, as I recall a couple of solutions were suggested:
- Have your program build and submit a separate job.
- Use dynamic allocation to allocate the new dataset, perhaps in a separate step. This could fairly easy be done in REXX, but dynamic allocation through BPXWDYN is also availabe for COBOL if you prefer that.
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1175
Location: Dublin, Ireland

PostPosted: Fri Sep 02, 2022 9:01 pm
Reply with quote

You might also use a DFSORT step to read the file and generate the required control card(s). This could be ahead of invoking your procedure or be a new step in the procedure.

The question is about the control card, not JCL or VSAM, imho.

Garry.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 1612

PostPosted: Sat Sep 03, 2022 1:02 am
Reply with quote

jaguyria wrote:
Hello superk,

Maybe I wasn't too clear.

I'll give you the following example:

In the input file (F0.INPUT.FILE) I have:
20220430blablabla
(...)

And I must generate the output dataset as
F0.20220430.20220902.1930
<=>
F0..&DATEIN..&FDATE..&FTIME

So I need to extract from the input file the date 20220430 into the exterior variable &DATEIN

How can I do it? Maybe is too easy for those who works with JCL daily (but it's not my case)..

Kind regards. Thanks for your time!


1. Please, first of all learn how to use the Code button when posting your questions:
Code:
F0.20220430.20220902.1930
<=>
F0..&DATEIN..&FDATE..&FTIME


2. There is no such thing in this world as "exterior variable &DATEIN". Not at all. Period.

3. You need to extract some data from your input, and to substitute those data into your output (which you may use later as control statements for your FTP utility).
There are thousands various tools in this world to do this task. The only two things not suitable for that are, JCL and VSAM. Try to choose a suitable tool out of thousands of available ones, which you are familiar with.

4. The intensity of "working with JCL daily" has no relation to the ability of conversion data from one input dataset to another output dataset. Those two tasks are on different planets.
Back to top
View user's profile Send private message
jaguyria

New User


Joined: 15 Feb 2022
Posts: 21
Location: Portugal

PostPosted: Mon Sep 05, 2022 3:14 pm
Reply with quote

Ok, thanks for your help, I'll continue doing my search.
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 Jes2 command output All Other Mainframe Topics 4
No new posts Selecting the max value from a file. DFSORT/ICETOOL 3
No new posts Change history of vsam file. JCL & VSAM 3
No new posts Generate output lines (SYSIN card for... DFSORT/ICETOOL 4
No new posts Split large FB file based on Key coun... DFSORT/ICETOOL 4
Search our Forums:

Back to Top