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

Variable Output file name


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Time2Live

New User


Joined: 27 Apr 2005
Posts: 43
Location: United States

PostPosted: Thu Jun 15, 2023 3:52 am
Reply with quote

Looking for a way to vary an output file name (cataloging) depending on what is in an input parm.

If input parm is AAAB1 I would like the output file name to be SYSTEM.AAAB1.DATA. The input parm would vary every day.

Is there a way to use File-Manager or ICETOOLS for this please?
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1255
Location: Bamberg, Germany

PostPosted: Thu Jun 15, 2023 5:25 am
Reply with quote

Use SYSTEM SYMBOLS in your JCL.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2023
Location: USA

PostPosted: Thu Jun 15, 2023 4:55 pm
Reply with quote

Time2Live wrote:
Looking for a way to vary an output file name (cataloging) depending on what is in an input parm.

If input parm is AAAB1 I would like the output file name to be SYSTEM.AAAB1.DATA. The input parm would vary every day.

Is there a way to use File-Manager or ICETOOLS for this please?

1. How your "input parm" looks like?? icon_pai.gif

2. How your "input parm" is related to the DFSORT/ICETOOL category?? icon_eyes.gif

3.
Code:
// SET INPARM='AAAB1'
// . . . . . . . .
//OUTPUT DD  DISP=(NEW,CATLG),DSN=SYSTEM.&INPARM..DATA,
// . . . .
Back to top
View user's profile Send private message
Time2Live

New User


Joined: 27 Apr 2005
Posts: 43
Location: United States

PostPosted: Thu Jun 15, 2023 8:53 pm
Reply with quote

Hi sergeyken,

I know the best way is to use a symbolic, but the 'AAAB1' (this will vary) will be in a file that the customer controls. How would I get that value from their input file into that &inparm value in the JCL?

I thought there may be a way to use ICETOOLS or FILE-Manager to read this input file and pull 'AAAB1' out and set the &inparm with that value.

Code:
EDIT       CUST.INPUT.FILE.DATA - 01.01
Command ===>
****** ***************************** Top of Data *******
000001 BLAHBLAHBLAH  AAAB1   XXXXXOTHER STUFF
****** **************************** Bottom of Data *****
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1255
Location: Bamberg, Germany

PostPosted: Thu Jun 15, 2023 9:48 pm
Reply with quote

Use a temporary PROCLIB, from there you can include the member with the settings. Guess that will work.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2023
Location: USA

PostPosted: Fri Jun 16, 2023 1:23 am
Reply with quote

Time2Live wrote:
Hi sergeyken,

I know the best way is to use a symbolic, but the 'AAAB1' (this will vary) will be in a file that the customer controls. How would I get that value from their input file into that &inparm value in the JCL?

I thought there may be a way to use ICETOOLS or FILE-Manager to read this input file and pull 'AAAB1' out and set the &inparm with that value.

Code:
EDIT       CUST.INPUT.FILE.DATA - 01.01
Command ===>
****** ***************************** Top of Data *******
000001 BLAHBLAHBLAH  AAAB1   XXXXXOTHER STUFF
****** **************************** Bottom of Data *****

In those cases I use two-steps approach:
    0) create the required dataset with a typical unique name, like
    Code:
    //REALDATA DD DISP=(NEW,CATLG),...,DSN=SYSTEM.$STD.DATA

    1) use any text-processing tool (I prefer SORT utility, but many options are available) - to generate, in a temporary DSN=&&ALTER, the statements (for IDCAMS, or other tool) - to rename the initial DSN to the required one -
    Code:
     ALTER SYSTEM.$STD.DATA NEWNAME( SYSTEM.AAAB1.DATA )

    2) run IDCAMS (or any other utility) using the dynamically generated statement(s) from #1 as the utility's input:
    Code:
    //RENAME EXEC PGM=IDCAMS
    // . . . . . . .
    //SYSIN DD DISP=(OLD,DELETE),DSN=&&ALTER


P.S.
All JCL SET-variables are resolved before job execution begins.
There is no way to change any SET-value while the job is running.
Same as macro-variables in some languages.

In C++ you cannot change MAX_VALUE which was defined as:

#define MAX_VALUE 100000
Back to top
View user's profile Send private message
Time2Live

New User


Joined: 27 Apr 2005
Posts: 43
Location: United States

PostPosted: Fri Jun 16, 2023 5:51 am
Reply with quote

Thank You sergeyken! The IDCAMS/ALTER/NEWNAME worked Great! Really appreciate icon_smile.gif
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2023
Location: USA

PostPosted: Fri Jun 16, 2023 7:52 pm
Reply with quote

Depending on your input parameters data, the operation can be hidden into a JCL PROC:
// EXEC RENAME,HLQ=SYSTEM,LLQ=DATA
//SORTIN DD DSN=SYSTEM.INPUT.PARAMS : 'xxxxx $STD xxxxx AAAB1 xxxxx'
//*

Code:
//RENAME   PROC HLQ='SYSTEM',LLQ='DATA'
//*===========================================
//GENALTER EXEC PGM=SORT,COND=(4,LT)
//SYSOUT   DD  SYSOUT=*
//SORTIN   DD  DISP=SHR,DSN=NULLFILE    dummy template
//SORTOUT  DD  DISP=(NEW,PASS),SPACE=(TRK,(1,1)),LRECL=80,
//             DSN=&&ALTER
//SYSIN    DD  *,SYMBOLS=EXECSYS
* Any input format like:    old_id new_id
 INREC PARSE=(%01=(STARTAFT=...,
                   ENDBEFR=...,
                   FIXLEN=8),
              %02=(STARTAFT=...,
                   ENDBEFR=...,
                   FIXLEN=8)),
       BUILD=(1:C'&HLQ..',%01,C'.&LLQ',80:X,
             81:C'&HLQ..',%02,C'.&LLQ',160:X)
 SORT FIELDS=COPY,STOPAFT=1
 OUTREC BUILD=(1,80,SQZ=(SHIFT=LEFT),
              81,80,SQZ=(SHIFT=LEFT))
 OUTFIL BUILD=(C' ALTER ',1,44,C' -',80:X,
             /,C'    NEWNAME( ',81,44,ะก' )',80:X)
//*
//*===========================================
//ALTER    EXEC PGM=IDCAMS,COND=(4,LT)
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  DISP=(OLD,DELETE),DSN=&&ALTER
//*
//*===========================================
//RENAME  PEND
Back to top
View user's profile Send private message
Time2Live

New User


Joined: 27 Apr 2005
Posts: 43
Location: United States

PostPosted: Mon Jun 19, 2023 3:43 am
Reply with quote

Yes! I see! That sounds good too! icon_cool.gif
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
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
Search our Forums:

Back to Top