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)
.
.
.
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 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
Joined: 15 Aug 2015 Posts: 1306 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.
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.
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
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.