Change HLQ of file being created

IBM's Command List programming language & Restructured Extended Executor
Jeff R
Posts: 27
Joined: Fri Dec 09, 2022 6:59 pm
Skillset: CA-7, JCL, SORT, Roscoe, TSO, REXX
Referer: just found you on the Internet

Change HLQ of file being created

Postby Jeff R » Mon Jan 02, 2023 8:39 pm

I am using the following in a REXX to create a file :

FILE_NAME = 'JOBTEST'
ADDRESS TSO "ALLOC F(ISPFILE) DA("FILE_NAME") UNIT(SYSDA)",
"SPACE(5,1) TRACKS DSORG(PS) RECFM(F,B) LRECL(80)",
"BLKSIZE(80) NEW CATALOG"

but the file is always named myuserid.JOBTEST...how do I change the HLQ to (for example) CAP. thus making the file named CAP.JOBTEST ?

willy jensen
Posts: 474
Joined: Thu Mar 10, 2016 5:03 pm
Skillset: assembler rexx zOS ispf racf smf
Referer: saw it in the experts foprum thought I could help here

Re: Change HLQ of file being created

Postby willy jensen » Mon Jan 02, 2023 11:05 pm

You use proper quoting, in your case either:

Code: Select all

FILE_NAME = "'CAP.JOBTEST'"
ADDRESS TSO "ALLOC F(ISPFILE) DA("FILE_NAME") UNIT(SYSDA)",

or

Code: Select all

FILE_NAME = 'CAP.JOBTEST'
ADDRESS TSO "ALLOC F(ISPFILE) DA('"FILE_NAME"') UNIT(SYSDA)",

And please call it a dataset, or some purist in this forum might take offense ;)

User avatar
Pedro
Posts: 686
Joined: Thu Jul 31, 2008 9:59 pm
Skillset: ISPF
Referer: google
Location: Silicon Valley

Re: Change HLQ of file being created

Postby Pedro » Mon Jan 02, 2023 11:28 pm

Another point is that TSO is honoring your profile setting. The prefix in your TSO profile is set to your userid. If you do not 'fully qualify' the data set name by enclosing it in single quotes, TSO will automatically prepend your default prefix. As Willy said, use the quotes to designate it as fully qualified, then TSO will not alter the name.

I suppose that this was intended as a time saver. And it is, as long as you know that it is happening.

read more: https://www.ibm.com/docs/en/zos/2.2.0?t ... ix-operand
Pedro Vera

Jeff R
Posts: 27
Joined: Fri Dec 09, 2022 6:59 pm
Skillset: CA-7, JCL, SORT, Roscoe, TSO, REXX
Referer: just found you on the Internet

Re: Change HLQ of file being created

Postby Jeff R » Mon Jan 02, 2023 11:54 pm

Thanks...and LOL...not sure why I opted for file instead of dataset in my description...sure hop I didn't offend anyone
so how do I create a GDG ?...assuming the base CAP.JOBTEST is defined

User avatar
Pedro
Posts: 686
Joined: Thu Jul 31, 2008 9:59 pm
Skillset: ISPF
Referer: google
Location: Silicon Valley

Re: Change HLQ of file being created

Postby Pedro » Mon Jan 02, 2023 11:57 pm

Use the DEFINE command to define a GDG.

See https://www.ibm.com/docs/en/zos/2.4.0?t ... ndatagroup
Pedro Vera

Jeff R
Posts: 27
Joined: Fri Dec 09, 2022 6:59 pm
Skillset: CA-7, JCL, SORT, Roscoe, TSO, REXX
Referer: just found you on the Internet

Re: Change HLQ of file being created

Postby Jeff R » Mon Jan 02, 2023 11:59 pm

The base is already defined

willy jensen
Posts: 474
Joined: Thu Mar 10, 2016 5:03 pm
Skillset: assembler rexx zOS ispf racf smf
Referer: saw it in the experts foprum thought I could help here

Re: Change HLQ of file being created

Postby willy jensen » Tue Jan 03, 2023 12:12 am

Well, to continue to be pedantic (and I personnally is not easily offended) you want to create a GDS, the GDG is the base definition.
TSO ALLOCATE cannot do it, but the BPXWDYN pgm can, and it is part of the base product. It is described in the manual 'Using REXX and z/OS UNIX System Services'.
Sample:

Code: Select all

cc=bpxwdyn('alloc da(some.test.gds(+1)) new catalog',    
           'lrecl(80) recfm(f,b) blksize(0)',          
           'tracks space(1,1) unit(sysda) dd(dd1)')  

One peculiarity is that BPXWDYN must have a fully qualified datasetname, and quoting is optional.
Be careful with the TSO prefix, it may not be the same as the userid, or be set at all. Which is why I do something like this when I want to use the userid / prefix:

Code: Select all

dspfx=word(sysvar('syspref') userid(),1)

to pick the first value.

Jeff R
Posts: 27
Joined: Fri Dec 09, 2022 6:59 pm
Skillset: CA-7, JCL, SORT, Roscoe, TSO, REXX
Referer: just found you on the Internet

Re: Change HLQ of file being created

Postby Jeff R » Tue Jan 03, 2023 12:39 am

Thanks Willy...I do agree on the GDG/GDS relationship...however in my shop EVERYONE refers to both as GDG.
I am not anywhere near an English Major, but I do know that "(and I personnally is not easily offended)" is not correct grammar...but, no offense taken...lol.
I see examples using "Call BPXWDYN"..."CC=" ??

willy jensen
Posts: 474
Joined: Thu Mar 10, 2016 5:03 pm
Skillset: assembler rexx zOS ispf racf smf
Referer: saw it in the experts foprum thought I could help here

Re: Change HLQ of file being created

Postby willy jensen » Tue Jan 03, 2023 12:53 am

I tend to use BPXWDYN as a function, I like functions. But CALL is fine too.
I also don't always distinguish between GDG and GDS, and I often call a dataset a file. Most of the times it really doesn't matter as long as all parties agree on the meaning.
And I will be more careful with my grammar henceforth :-)

Jeff R
Posts: 27
Joined: Fri Dec 09, 2022 6:59 pm
Skillset: CA-7, JCL, SORT, Roscoe, TSO, REXX
Referer: just found you on the Internet

Re: Change HLQ of file being created

Postby Jeff R » Tue Jan 03, 2023 9:29 pm

Having issue creating more than first GDS...creates G0001V00 ok but will not create G0002V00...GDG is defined with LIMIT(2)...using :

/* REXX */

CALL BPXWDYN('ALLOC DA(CAP.UL04LBOX.TEST(+1)) NEW CATALOG',
'LRECL(80) RECFM(F,B) BLKSIZE(0)',
'TRACKS SPACE(1,1) UNIT(SYSDA) DD(DD1)')
EXIT

if I delete G0001V00 then it has no issue creating G0001V00 again...just will not create G0002V00 when G0001V00 exists


  • Similar Topics
    Replies
    Views
    Last post