REXX in batch and stand alone behaves differently.

Time Sharing Option, Interactive System Productivity Facility and REstructured eXtended eXecutor

Moderator: mickeydusaor

Post Reply
BappiL
New Member
Posts: 5
Joined: Sat Sep 19, 2015 8:54 pm

REXX in batch and stand alone behaves differently.

Post by BappiL »

Hi,

I am trying to run the following REXX using a JCL:

Code: Select all

/* REXX */                                          
"EXECIO * DISKR INFILE (STEM LINE1. FINIS"          
 J = 1                                              
DO J=1 TO LINE1.0                                  
   IF SUBSTR(LINE1.I,104,13) = 'ARCHIVE DATE:' THEN 
      DO                                            
      OUT1.J = SUBSTR(LINE1.I,104,25)              
      J=J+1                                        
      END                                          
   ELSE                                            
      J=J+1                                        
END                                                
SAY RC                                              
"EXECIO * DISKW OUTFILE (STEM OUT1. FINIS"          
"FREE F(INPF OUTPF)"                            
EXI
And the JCL is:

Code: Select all

/REXXJCL    EXEC PGM=IKJEFT01,DYNAMNBR=20                      
//SYSEXEC DD DSN=ABCD.DEFG.EXECPDS,DISP=SHR                  
//SYSPRINT DD SYSOUT=*                                        
//SYSTSPRT DD SYSOUT=*                                        
//INFILE DD DSN=ABCD.EFGH.FILE,DISP=SHR                      
//*UTFILE DD SYSOUT=*                                          
//OUTFILE DD DSN=ABCD.EFGH.OUTFILE,                          
//             DISP=(NEW,CATLG,DELETE),                        
//             SPACE=(CYL,(10,10),RLSE),                      
//             DCB=(RECFM=FBA,LRECL=133,BLKSIZE=1330,DSORG=PS) 
//SYSTSIN DD *                                                
PROFILE PREFIX(EFGH)                                        
%ABHIMAIL  
But nothing is written in output. I am getting empty output file. ABCD.EFGH.OUTFILE is empty. But when I run the EXEC individually the output comes as expected. Please help.
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: REXX in batch and stand alone behaves differently.

Post by nicc »

And what does your SYSTSPRT say?

Where do you initialise I as used in

Code: Select all

IF SUBSTR(LINE1.I...
and where do you increment it.

How does this differ from "stand alone" (whatever that means (foreground?) which you mention in your title?
Regards
Nic
enrico-sorichetti
Global Moderator
Global Moderator
Posts: 826
Joined: Wed Sep 11, 2013 3:57 pm

Re: REXX in batch and stand alone behaves differently.

Post by enrico-sorichetti »

Code: Select all

DO J=1 TO LINE1.0                                  
   IF SUBSTR(LINE1.I,
I did not comment because it looked liked a typo
( retyping rather than cut and paste )
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort 8-)
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: REXX in batch and stand alone behaves differently.

Post by nicc »

Except he uses I twice. Once is forgivable but twice is "get a new job"
Regards
Nic
enrico-sorichetti
Global Moderator
Global Moderator
Posts: 826
Joined: Wed Sep 11, 2013 3:57 pm

Re: REXX in batch and stand alone behaves differently.

Post by enrico-sorichetti »

NOPE...
the typo was in the DO statement...
should have been

Code: Select all

DO i = .....
if the Do had been the right statement
the script would have skipped a line for each iteration

Code: Select all

J = j +1 
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort 8-)
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: REXX in batch and stand alone behaves differently.

Post by nicc »

If it was a typo then he would have had an error in SYSTSPRT - if he cut and pasted from screen. If he did not cut and paste - what a wasted effort!

If his actual code was correct (do I = ...) and his first line of input was not required as output then I don't know what would have happened as OUT1 would have started at OUT1.2 at least, if not greater. What he should have done was not increment J if the input line was not required and set OUT1.0 with the value of J after all input had been processed and used OUT1.0 as the number of lines to write. OK - could have just used J but I prefer to set stem.0 and use that.
Regards
Nic
BappiL
New Member
Posts: 5
Joined: Sat Sep 19, 2015 8:54 pm

Re: REXX in batch and stand alone behaves differently.

Post by BappiL »

Sorry for the typos. Please see the below code:

Code: Select all

/* REXX */                                          
"EXECIO * DISKR INFILE (STEM LINE1. FINIS"          
 J = 1                                              
DO J=1 TO LINE1.0                                  
   IF SUBSTR(LINE1.J,104,13) = 'ARCHIVE DATE:' THEN 
      DO                                            
      OUT1.J = SUBSTR(LINE1.J,104,25)              
      J=J+1                                        
      END                                          
   ELSE                                            
      J=J+1                                        
END                                                
SAY RC                                              
"EXECIO * DISKW OUTFILE (STEM OUT1. FINIS"          
"FREE F(INPF OUTPF)"                            
EXIT
Can the first post be corrected as well? I can't edit it now.
enrico-sorichetti
Global Moderator
Global Moderator
Posts: 826
Joined: Wed Sep 11, 2013 3:57 pm

Re: REXX in batch and stand alone behaves differently.

Post by enrico-sorichetti »

things are getting worse and worse

You are incrementing J twice
once in the do statement
once more with j = j + 1

so You are skipping all the odd lines
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort 8-)
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “TSO, ISPF & REXX (Do you still do CLIST?!).”