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 ?
Change HLQ of file being created
-
- 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
You use proper quoting, in your case either:
or
And please call it a dataset, or some purist in this forum might take offense
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

- 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
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
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
-
- 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
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
so how do I create a GDG ?...assuming the base CAP.JOBTEST is defined
- 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
Pedro Vera
-
- 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
The base is already defined
-
- 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
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:
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:
to pick the first value.
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.
-
- 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
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=" ??
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=" ??
-
- 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
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
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

-
- 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
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
/* 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
-
-
Can i read output file created after SORTing in the same pgm
by savitha_y » Sat Feb 06, 2021 1:17 am » in IBM Cobol - 4
- 1613
-
by savitha_y
View the latest post
Tue Feb 09, 2021 7:11 pm
-
-
- 2
- 2736
-
by willy jensen
View the latest post
Sat Mar 04, 2023 12:41 pm
-
- 2
- 1393
-
by PRDVCF
View the latest post
Thu Nov 17, 2022 9:58 pm
-
- 1
- 1248
-
by willy jensen
View the latest post
Sat Sep 04, 2021 12:51 am
-
-
SORT to add trailer record on change of key + Date
by Prashant_2021 » Fri Aug 27, 2021 11:04 pm » in DFSORT/ICETOOL/ICEGENER - 1
- 1669
-
by sergeyken
View the latest post
Sat Aug 28, 2021 11:15 pm
-