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/
PL1 SUBROUTINE CODE VERFICATION
-
- Posts: 8
- Joined: Sat Jul 24, 2021 10:04 pm
- Skillset: cobol db2
- Referer: internet
- sergeyken
- Posts: 458
- Joined: Wed Jul 24, 2019 10:12 pm
- Skillset: Assembler, JCL, Utilities, PL/I, C/C++, DB2, SQL, REXX, COBOL, etc. etc. etc.
- Referer: Internet search
Re: PL1 SUBROUTINE CODE VERFICATION
Please, use code tags when presenting your code.
Javas and Pythons come and go, but JCL and SORT stay forever.
-
- Similar Topics
- Replies
- Views
- Last post
-
- 9
- 9439
-
by sergeyken
View the latest post
Mon Jul 26, 2021 6:16 am
-
- 0
- 3107
-
by enrico-sorichetti
View the latest post
Fri Apr 01, 2022 6:00 pm
-
- 4
- 9223
-
by grasshopper
View the latest post
Mon Jul 26, 2021 9:17 am
-
- 1
- 3847
-
by NicC
View the latest post
Tue Sep 15, 2020 5:37 pm
-
- 5
- 4860
-
by cr22
View the latest post
Tue Aug 15, 2023 1:52 am