Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Issue with executing REXX in batch

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
pshongal

New User


Joined: 14 Jun 2012
Posts: 70
Location: India

PostPosted: Thu Sep 18, 2014 12:41 pm    Post subject: Issue with executing REXX in batch
Reply with quote

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
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Sep 18, 2014 1:13 pm    Post subject: Reply to: Issue with executing REXX in batch
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Sep 18, 2014 2:28 pm    Post subject: Reply to: Issue with executing REXX in batch
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1712
Location: UK

PostPosted: Thu Sep 18, 2014 8:50 pm    Post subject: Reply to: Issue with executing REXX in batch
Reply with quote

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
View user's profile Send private message
pshongal

New User


Joined: 14 Jun 2012
Posts: 70
Location: India

PostPosted: Fri Sep 19, 2014 10:51 am    Post subject:
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri Sep 19, 2014 11:29 am    Post subject: Reply to: Issue with executing REXX in batch
Reply with quote

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
View user's profile Send private message
pshongal

New User


Joined: 14 Jun 2012
Posts: 70
Location: India

PostPosted: Fri Sep 19, 2014 12:00 pm    Post subject:
Reply with quote

RC is 20.

Code:

READY                       
 %LISTDD                   
SORRY FILE NOT FOUND, RC=  20   
READY                       
END                         
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri Sep 19, 2014 12:02 pm    Post subject: Reply to: Issue with executing REXX in batch
Reply with quote

RTFM
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 645
Location: Pennsylvania

PostPosted: Fri Sep 19, 2014 5:14 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1218
Location: Israel

PostPosted: Mon Sep 22, 2014 5:01 pm    Post subject:
Reply with quote

pshongal wrote:
expected O/P: "ABC.XYZ.20140923233233.ACK.CSV"
Is that a dsname ???
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How does a called pgm know if its cal... Graeme Westerman COBOL Programming 4 Tue Nov 29, 2016 9:25 pm
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
This topic is locked: you cannot edit posts or make replies. MIPS reduction for Batch job Virendra Shambharkar All Other Mainframe Topics 8 Mon Nov 07, 2016 4:02 pm
No new posts DFHRESPONSE returns issue divated CICS 3 Wed Nov 02, 2016 6:32 pm
This topic is locked: you cannot edit posts or make replies. Rexx to create GDG by scanning JJ result krish.deepu CLIST & REXX 5 Tue Oct 25, 2016 5:32 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us