|
|
| Author |
Message |
sniperd
New User
Joined: 27 Aug 2005 Posts: 3
|
|
|
|
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 |
|
 |
References
|
Posted: Sun Sep 11, 2005 11:29 pm Post subject: Re: Confusion about STEM Variables... |
 |
|
|
 |
MGIndaco
Moderator
Joined: 10 Mar 2005 Posts: 479 Location: Milan, Italy
|
|
|
|
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
and
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 |
|
 |
|
|