1. An subprogram receives 5 parameters
- CHAR VAR String with max. 200 bytes length
- Table with unknown number of elements Index lower limit 1, elements CHAR (01)
- BIN FIXED (15) (for current table size)
- Table with unknown number of elements Index lower limit 1, elements PIC '9'.
- BIN FIXED (15) (for current table size)
Task of the subroutine:
- transfer all digits of the 1st parameter to table2 (4th parameter)
- ignore all blanks
- transfer remaining characters to table1 (2nd parameter)
- in parameters 3 and 5 the current number of table elements is to be stored in each case
how to Code the subprogram, am ok with cobol but pl1 confuses me and i have no time to sit and debug
/code
EXTSUB1: PROC(NAMESTR, TAB1, TSIZE1, TAB2, TSIZE2);
DCL NAMESTR CHAR(200);
DCL TAB1(1:*) CHAR(01);
DCL TSIZE1 FIXED BIN(15);
DCL TAB2(1:*) PICβ9β;
DCL TSIZE2 FIXED BIN(15);
DCL LSZ1 FIXED BIN(15);
DCL LSTR CHAR(1);
DO
I = 1 BY 1 TO LENGTH(NAMESTR);
LSTR = SUBSTR(NAMESTR, I, 1);
LSZ1 = VERIFY(LSTR, β0123456789β)
IF (LSZ1 = 0) THEN (TSIZE1=TSIZE1+1, TAB1(i);
ELSE (TSIZE2=TSIZE2+1, TAB2(i);
END;
END EXTSUB1;
code/