PL1 SUBROUTINE CODE VERFICATION



IBM's cross-platform compiler PL/I for MVS, VM & VSE, OS/390 and Enterprise PL/I for z/OS

PL1 SUBROUTINE CODE VERFICATION

Postby grasshopper » Mon Jul 26, 2021 2:19 am

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/
grasshopper
 
Posts: 8
Joined: Sat Jul 24, 2021 10:04 pm
Has thanked: 0 time
Been thanked: 0 time

Re: PL1 SUBROUTINE CODE VERFICATION

Postby sergeyken » Mon Jul 26, 2021 5:53 am

Please, use code tags when presenting your code.
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 408
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 6 times
Been thanked: 40 times


Return to PL/I

 


  • Related topics
    Replies
    Views
    Last post