Change HLQ of file being created



IBM's Command List programming language & Restructured Extended Executor

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 ?
Jeff R
 
Posts: 27
Joined: Fri Dec 09, 2022 6:59 pm
Has thanked: 4 times
Been thanked: 0 time

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:
FILE_NAME = "'CAP.JOBTEST'"
ADDRESS TSO "ALLOC F(ISPFILE) DA("FILE_NAME") UNIT(SYSDA)",

or
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 ;)
willy jensen
 
Posts: 419
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 61 times

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
User avatar
Pedro
 
Posts: 672
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 51 times

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
Jeff R
 
Posts: 27
Joined: Fri Dec 09, 2022 6:59 pm
Has thanked: 4 times
Been thanked: 0 time

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
User avatar
Pedro
 
Posts: 672
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 51 times

Re: Change HLQ of file being created

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

The base is already defined
Jeff R
 
Posts: 27
Joined: Fri Dec 09, 2022 6:59 pm
Has thanked: 4 times
Been thanked: 0 time

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:
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:
dspfx=word(sysvar('syspref') userid(),1)

to pick the first value.
willy jensen
 
Posts: 419
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 61 times

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=" ??
Jeff R
 
Posts: 27
Joined: Fri Dec 09, 2022 6:59 pm
Has thanked: 4 times
Been thanked: 0 time

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 :-)
willy jensen
 
Posts: 419
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 61 times

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
Jeff R
 
Posts: 27
Joined: Fri Dec 09, 2022 6:59 pm
Has thanked: 4 times
Been thanked: 0 time

Next

Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post