Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
Confusion about STEM Variables...

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
Author Message
sniperd

New User


Joined: 27 Aug 2005
Posts: 3

PostPosted: Sun Sep 11, 2005 11:29 pm    Post subject: Confusion about STEM Variables...
Reply with quote

Im writing a program that has a loop that goes through a stem variable
and sorts the input into 2 other stem's.

I was under the impression that VARIABLE.0 ALWAYS held the number of records in the stem. It doesnt seem to and i have to do a counter to get the crap to work right.

It seems in my first stem that it holds it though. TOUT.0 holds the #, but BNDM.0 and GNDM.0 have to be forced to be counted. Additionally when i go through a loop to print the STEM, If their is not a valid input to it its like, putting 'BNDM.3' or whatever into the stem in its place.


The end result im looking for is all PROCN = 0 into GNDM.* and anything other then that (greater then 0) into BNDM.* and then be able to print them in a list.

Please help!

Heres my code:
Code:

/* REXX */                                                                         
"ALLOC F(TMPOUT) DA('XXXX.TMPOUT') SHR"
'EXECIO * DISKR TMPOUT (STEM TOUT. FINIS'
'FREE FI(TMPOUT)'                         
BNDM. = 0                                 
GNDM. = 0                                 
DO I = 1 TO TOUT.0                       
PARSE VAR TOUT.I 10 PROCN +4             
IF PROCN = '0000'                         
THEN                                     
  DO                                     
     GNDM.0 = GNDM.0 + 1                 
     GNDM.I = TOUT.I                     
  END                                     
ELSE                   
  DO                   
     BNDM.0 = BNDM.0 + 1
     BNDM.I = TOUT.I   
                       
  END                   
END                     
SAY 'BAD NDM COUNT: ' BNDM.0 
SAY 'GOOD NDM COUNT: ' GNDM.0


Input file is this:

JOBNA4E1 0009
JOBNA3E1 0000
JOBN9ME1 0019
JOB8AME1 0000
JO2NAME1 0039
JOBN3ME1 0000
J1BNAME1 0000
JOBN2ME1 0000
JOBNAM31 0055
JOB2AME1 00XX
JOBNAME4 0000
JOBNAME4 0000
JOBNAME4 0000
JOBNAME4 0000
JOBNAME4 0000
JOBNAME4 0000
JOBNAME4 0000
JOBNAME4 0000
Back to top
View user's profile Send private message
References
PostPosted: Sun Sep 11, 2005 11:29 pm    Post subject: Re: Confusion about STEM Variables... Reply with quote

MGIndaco

Moderator


Joined: 10 Mar 2005
Posts: 479
Location: Milan, Italy

PostPosted: Mon Sep 12, 2005 7:54 pm    Post subject:
Reply with quote

This is the link from the Rexx Manual:
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/IKJ4A350/2.4.4?DT=20040623084642
But I think that your method has a problem...
Doing this:
Code:
DO I = 1 TO TOUT.0                       
PARSE VAR TOUT.I 10 PROCN +4             
IF PROCN = '0000'                         
THEN                                     
  DO                                     
     GNDM.0 = GNDM.0 + 1                 
     GNDM.I = TOUT.I                     
  END                                     
ELSE                   
  DO                   
     BNDM.0 = BNDM.0 + 1
     BNDM.I = TOUT.I   
                       
  END                 
END           

Is not the same than this:
Code:
I1 = 0
I2 = 0
DO I = 1 TO TOUT.0                       
PARSE VAR TOUT.I 10 PROCN +4             
IF PROCN = '0000'                         
THEN                                     
  DO                                     
     GNDM.0 = GNDM.0 + 1 /*you can also use directly I1 */                 
     I1     = I1 + 1
     GNDM.I1 = TOUT.I                     
  END                                     
ELSE                   
  DO                   
     BNDM.0 = BNDM.0 + 1 /*you can also use directly I2 */
     I2     = I2 + 1
     BNDM.I2 = TOUT.I   
                       
  END                   
END           

The value of the element of your stem is not in the range of STEM.0
I try to explain the concept in the better way I know:
"I" value is from input and can be a number in the range from 1 to TOUT.0
So, if you move TOUT.I into BNDM.I you will put the value at the "I" position that is differente from BNDM.0
In a particular case you can have a
Code:
BNDM.10
BNDM.11
and
Code:
BNDM.0 = 2
but when you try to write the content of your stem you will have nothing because in the
BNDM.1 and BNDM.2 you have not value(you will have empty value)

Try to modify your source.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1