|
View previous topic :: View next topic
|
| Author |
Message |
Saranya Mani
New User
Joined: 07 May 2021 Posts: 2 Location: India
|
|
|
|
Hi,
This is my first post and very excited to see the results.
I am new to REXX..
To create bulk ps file in same record length and format i need code..
My code is not working
This is my code.
ADDRESS TSO
"alloc da('******.jcl.lib(T5358S1V)') fi(gdgver) shr reuse"
"execio * diskr gdgver (stem write. finis"
write.1 = '//******* JOB ''NEW VER'','
write.2 = '// MSGCLASS=M,'
write.3 = '// CLASS=B,'
write.4 = '// MSGLEVEL=(1,1)'
write.5 = '//*'
write.6 = '//STEP01 EXEC PGM=IEFBR14'
write.7 = '//INPUT DD'
w=7
"alloc da('********.C.LIST') fi(input) shr reuse"
"execio * diskr input (stem read. finis"
do i=1 to read.0 by 1
dsname = word(read.i,1)
w=w+1
write.w= '// DSN=('dsname'),'
w=w+1
write.w= '// DISP=(NEW,KEEP,DELETE),'
w=w+1
write.w= '// UNIT=SYSDA,SPACE=(TRK,5),'
w=w+1
write.w= '// DCB=(LRECL=1000,RECFM=FB,DSORG=PS)'
w=w+1
end
"execio * diskw gdgver (stem write. finis"
in *******.c.list i have the new file names
I am trying to create multiple
dd dsn=aaaaa, disp=(new,catlg,delete)
dd dsn=bbbbb, disp=(new,catlg,delete)
.
.
. |
|
| Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1448 Location: Bamberg, Germany
|
|
|
|
Please, use code tags (button) when presenting code/data. They work as a toggle but allow us to help you better.
Show error msgs! |
|
| Back to top |
|
 |
Saranya Mani
New User
Joined: 07 May 2021 Posts: 2 Location: India
|
|
|
|
| Code: |
The result is its creating jcl to create bulk ps files, like the below
//***** JOB 'NEW VER',
// MSGCLASS=M,
// CLASS=B,
// MSGLEVEL=(1,1)
//*
//STEP01 EXEC PGM=IEFBR14
//INPUT DD
// DSN=(*******.GDG1),
// DISP=(NEW,KEEP,DELETE),
// UNIT=SYSDA,SPACE=(TRK,5),
// DCB=(LRECL=1000,RECFM=FB,DSORG=PS)
// DCB=(LRECL=1000,RECFM=FB,DSORG=PS)
// DSN=(******.GDG2),
// DISP=(NEW,KEEP,DELETE),
// UNIT=SYSDA,SPACE=(TRK,5),
// DCB=(LRECL=1000,RECFM=FB,DSORG=PS)
// DCB=(LRECL=1000,RECFM=FB,DSORG=PS)
// DCB=(LRECL=1000,RECFM=FB,DSORG=PS)
|
The jcl is creating wrong..
I have create multiple gdg bases and want to create dummy generations for all gdg bases created |
|
| Back to top |
|
 |
Willy Jensen
Active Member

Joined: 01 Sep 2015 Posts: 778 Location: Denmark
|
|
|
|
A couple of things...
Never ever use '*' for record count in EXECIO DISKW, use the actual number. And you haven't set write.0, which would be required for EXECIO * DISKW.
You are using the same dataset for output as for input, do you really intend to destroy your input?
You are not freeing the dataset(s) when you are finished.
In this case I would recommend using QUEUE in stead of a stem for generating the statements.
I will recommend the BPXWDYN program instead of ALLOCATE and FREE.
Don't call them files, they are datasets (you will offend some people when saying 'file').
Have a look at this:
| Code: |
/* get list of datasets */
cc=Bpxwdyn('alloc da(dataset.with.list) shr rtddn(ldd)')
if cc<>0 then exit xmsg('alloc listds rc' cc)
"execio * diskr" ldd "(stem list. finis)"
cc=Bpxwdyn('free dd('ldd')')
/* make job stmt */
queue "//JOB1 JOB ..."
queue "//... etc ..."
/* make allocation steps */
do n=1 to list.0
queue '//DS'right(n,6,0) 'DD DSN='word(list.n,1)','
queue left('//',13) 'UNIT=SYSDA,SPACE=(TRK,5),'
queue left('//',13) 'LRECL=1000,RECFM=FB,DSORG=PS'
end
/* write generated job */
cc=Bpxwdyn('alloc da(output.dataset) shr rtddn(odd)')
if cc<>0 then exit xmsg('alloc output rc' cc)
"execio" queued() "diskw" odd "(finis)"
cc=Bpxwdyn('free dd('odd')')
exit xmsg('Done..')
XMsg: if arg(1)<>'' then say arg(1);return word(arg(2) 0,1) |
And once you have it working, you can write the output directly to spool by
| Code: |
cc=Bpxwdyn('sysout(x) lrecl(80) recfm(f,b) blksize(0)',
'writer(intrdr) rtddn(odd)') |
|
|
| Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1448 Location: Bamberg, Germany
|
|
|
|
Thanks Willy for the update.
I would also add to check Return Codes when executing functions, see Willy's sample. Were data read, was open/close successful and such. These are basics in programming. |
|
| Back to top |
|
 |
Willy Jensen
Active Member

Joined: 01 Sep 2015 Posts: 778 Location: Denmark
|
|
|
|
| Forgot to mention, you should have a "DELSTACK" at the front, or even better a "NEWSTACK" at the front and a "DELSTACK" at the back to prevent include of a residual stack. |
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2290 Location: USA
|
|
|
|
| Willy Jensen wrote: |
| Never ever use '*' for record count in EXECIO DISKW, use the actual number. And you haven't set write.0, which would be required for EXECIO * DISKW. |
This is partially true.
1) "EXECIO * DISKW ddname (STEM write." (unlike DISKR) doesn't use the value from write.0 directly. One needs to specify it explicitly (out of quotes!, for REXX to substitute its value into EXECIO command):
| Code: |
| "EXECIO" write.0 "DISKW ddname (STEM write. … " |
This is true also for writing from program stack
| Code: |
"EXECIO" write.0 "DISKW ddname"
or
"EXECIO" w "DISKW ddname" |
2) "EXECIO * DISKW ddname (STEM write." tries to write stem or stack elements until either the first not-defined one found, or the first empty string value (e.g. "") detected. This behavior is inconvenient in many cases, that's why using the option "EXECIO * DISKW" is not recommended |
|
| Back to top |
|
 |
Willy Jensen
Active Member

Joined: 01 Sep 2015 Posts: 778 Location: Denmark
|
|
|
|
sergeyken is quite correct, thank you for correcting, stem.0 is not required for DISKW *, so DISKW * would work in your case, and indeed for my sample too, as there are no null items.
I still will recommend using a number, as I know people who have been bitten by that null value. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|