View previous topic :: View next topic
|
Author |
Message |
pshongal
New User
Joined: 14 Jun 2012 Posts: 96 Location: India
|
|
|
|
Hi,
I have below code which will list the dataset name and writes the name in a new file.
Issue is, when I execute interactively using EX command, I am getting the output properly.
But when I execute it in batch, out put is not proper.
I/P: "ABC.XYZ.D1201409.D22323.D33233" (values after D1, D2 and D3 changes everytime)
expected O/P: "ABC.XYZ.20140923233233.ACK.CSV"
actual O/P from job: "ABC.XYZ. spaces .ACK.CSV"
Code: |
HLQ = "ABC.XYZ.D1*"
PROCESS:
"ISPEXEC LMDINIT LISTID(DSLISTID) LEVEL("HLQ")"
IF RC ¬= 0 THEN
DO
SAY = "SORRY FILE NOT FOUND."
END
"ISPEXEC LMDLIST LISTID("DSLISTID") OPTION(SAVEC)",
"DATASET (DSNAME) STATS(YES)"
IF RC ¬= 0 THEN
DO
SAY = "DSLIST FAILED"
END
SAY 'FILE NAME 'DSNAME
F2 = 'AAA.BBB.ACK'
OUTL.1 = "ABC.XYZ."||SUBSTR(DSNAME,18,6)||SUBSTR(DSNAME,27,4)||,
SUBSTR(DSNAME,34,4)||".ACK.CSV"
SAY 'FILE1 'F1
SAY 'FILE2 'F2
ADDRESS TSO "ALLOC FI(INDD) DA('"||F2||"') NEW",
"TRACK SPACE(1 1) RECFM(F B) LRECL(80) BLKSIZE(800) REUS",
"UNIT(SYSDA) DSORG(PS)"
ADDRESS TSO 'EXECIO 0 DISKW INDD(OPEN '
ADDRESS TSO 'EXECIO * DISKW INDD(STEM OUTL.'
ADDRESS TSO 'EXECIO * DISKW INDD(FINIS '
ADDRESS TSO 'FREE FI(INDD)'
EXIT
|
|
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
what do You expect to find at SUBSTR(DSNAME,34,4)
when the dsname is just 30 chars ?
why not run it with a TRACE ON to see what is going on ?
check also Your TSO profile PREFIX setting
I guess that it works under TSO because of the PREFIX being turned on |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
it would have been nice if You had posted something better than a snippet that does not make any sense whiteout knowing more details
JUST LOOKING AT THE SNIPPET POSTED
the
LMDINIT does not care about dataset existence ( TESTED )
SAVEC option saves also the catalog ...
DATASET(DSNAME) tells where to start saving
and You use the DSNAME variable without having it initialised nowhere
so when using it on the right side of a statement it contains DSNAME
and worst of all , even if You check the return codes You just keep going on
and...
and...
and...
pretty sloppy coding
if You want good answers, learn to post meaningful data |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
And: do not do a 'EXECIO * DISKW' use the actual count as held in OUTL.0 (which you appear not to have maintained). Actually, it looks as though you are using a stem when you do not need one: instead of assigning th OUTL.1 assign to OUTL1 and pass that to EXECIO and use 'EXECIO 1 DISKW ' |
|
Back to top |
|
|
pshongal
New User
Joined: 14 Jun 2012 Posts: 96 Location: India
|
|
|
|
Hi Enrico,
I have corrected the code as you pointed out.
I did trace on and see that, its giving FILE NOT FOUND error.
Code: |
"ISPEXEC LMDINIT LISTID(DSLISTID) LEVEL("HLQ")"
IF RC ¬= 0 THEN
DO
SAY = "SORRY FILE NOT FOUND."
END
|
So. its failing here itself. Do I need to remobe ISPEXEC while running in batch?
Hi, Nic
Thanks for poiting it out. I will change it accordingly. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
Quote: |
I did trace on and see that, its giving FILE NOT FOUND error. |
why not display the return code and ...RTFM !
LMDINIT DOES NOT CARE ABOUT THE "HLQ" EXISTANCE
if You display an error message at least You should display it with the right description |
|
Back to top |
|
|
pshongal
New User
Joined: 14 Jun 2012 Posts: 96 Location: India
|
|
|
|
RC is 20.
Code: |
READY
%LISTDD
SORRY FILE NOT FOUND, RC= 20
READY
END
|
|
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
RTFM |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
Please show the JCL you use to start ispf and execute your rexx.
P.S. There is a major hint within the request |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
pshongal wrote: |
expected O/P: "ABC.XYZ.20140923233233.ACK.CSV" |
Is that a dsname ??? |
|
Back to top |
|
|
|