03-31-2015 03:14 PM
I read this post. I have a similar issue. Could you please review and let me know the proper syntax for this operation.
DATA PASS_STR FAIL_STR;
ARRAY ASTR(*) _CHARACTER_;
DO C=1 TO CW BY 1 WHILE(MATCH='Y');
IF F=0 THEN MATCH='N';
PUT C CW F MATCH ASTR(C) STRENGTH;
IF MATCH='Y' THEN OUTPUT PASS_STR;
IF MATCH='N' THEN OUTPUT FAIL_STR;
The result I get is the following. As you can see as soon as the program starts reading the second array component it fails to find the ASTR(2).
1 4 15 Y 1.23 1.25MG;1.25MG;1.23MG;1.25MG
2 4 0 N 1.25 1.25MG;1.25MG;1.23MG;1.25MG
1 4 1 Y 1.875 1.875MG;1.875MG;1.875MG;1.875MG
2 4 0 N 1.875 1.875MG;1.875MG;1.875MG;1.875MG
1 4 1 Y 2.5 2.5MG;2.5MG;2.5MG;2.5MG
2 4 0 N 2.5 2.5MG;2.5MG;2.5MG;2.5MG
When I take the SCAN process outside of the above DO loop and run it in its own DO loop I am not able to populate beyond ASTR(2). I get zero values for ASTR(3) and ASTR(4) values
DO C=1 TO CW BY 1;
Can you please review the situation above and assist.
04-06-2015 07:11 AM
My colleague found the solution to the above issue.
STRIP Function is to be used instead of TRIM. STRIP function removes both leading and trailing blanks. While trim only removes trailing blanks.
So the Syntax used was
Also, there was no need for using Arrays. I could loop the record using the DO LOOP as I originally planned.