View previous topic :: View next topic
|
Author |
Message |
km_abdullah
New User
Joined: 03 Nov 2008 Posts: 60
|
|
|
|
Hi,
I am using PLISRTD sort in my PL/I program to sort an input file and write the output in the SPOOL.
Logic I used:
Input procedure - will read a file into an array.
Output procedure - will print the output in SPOOL.
I referred the following site,
publib.boulder.ibm.com/infocenter/pdthelp/v1r1/index.jsp?topic=/com.ibm.entpli6.doc/sort-yyy.htm
for the syntax and usage of PLISRTD. However I am getting return code of 16 which am unable to debug. Please help me to understand where the problem is. My code below -
I = 0;
CALL PLISRTD ('SORT FIELDS=(19,6,CH,D)',
'RECORD TYPE=F, LENGTH=(100)',
1048576,
RETCODE,
GET_INPUT,
PRINT_OUTPUT);
SELECT(RETCODE);
WHEN(0) PUT SKIP EDIT
('SORT COMPLETE RETURN_CODE 0') (A);
WHEN(20) PUT SKIP EDIT
('SORT MESSAGE DATASET MISSING ') (A);
OTHER PUT SKIP EDIT
('INVALID RETURN_CODE = ', RETCODE) (A,F(2));
END /* SELECT */;
CALL PLIRETC(RETCODE);
PUT SKIP LIST('END OF PLISORT');
GET_INPUT: PROC RETURNS(CHAR(100));
DCL INFIELD(50) CHAR(100);
I = I + 1;
ON ENDFILE(SFILE) BEGIN;
PUT SKIP LIST('END OF FILE');
CALL PLIRETC(8);
GOTO STOP_READ;
END;
READ FILE(SFILE) INTO (INFIELD(I));
DO;
PUT SKIP LIST(INFIELD(I));
PUT SKIP LIST('GET_INPUT REACHED');
CALL PLIRETC(12);
RETURN(INFIELD(I));
END;
STOP_READ:
END GET_INPUT;
PRINT_OUTPUT: PROC(INREC);
DCL INREC CHAR(100);
PUT SKIP LIST (INREC);
PUT SKIP LIST('PRINT_OUTPUT REACHED');
CALL PLIRETC(4);
END PRINT_OUTPUT; |
|
Back to top |
|
|
km_abdullah
New User
Joined: 03 Nov 2008 Posts: 60
|
|
Back to top |
|
|
Gnanas N
Active Member
Joined: 06 Sep 2007 Posts: 792 Location: Chennai, India
|
|
|
|
Hi Mohamed,
Please post the complete error info along with mentioning RC 16. |
|
Back to top |
|
|
km_abdullah
New User
Joined: 03 Nov 2008 Posts: 60
|
|
|
|
Hi Gnanas,
I am not getting any error message in the spool. As per the code i only get the following in spool -
CTRL BEFORE PLISRT
INVALID RETURN_CODE = 16
END OF PLISORT
Or do you want me to look into JESSYSMSG or look for any error message. Am not able to find any useful clue from the spool.
Please advise.
Regards
Mohamed |
|
Back to top |
|
|
Gnanas N
Active Member
Joined: 06 Sep 2007 Posts: 792 Location: Chennai, India
|
|
|
|
Hi Mohamed,
Why do you use an array, ie, INFIELD(50) in GET_INPUT procedure?
It ran fine while coding with out that array.
I think there is no need to use that array.
Please let me know what you are looking for. |
|
Back to top |
|
|
km_abdullah
New User
Joined: 03 Nov 2008 Posts: 60
|
|
|
|
Dear Gnanas,
As per our discussions thru PMs it worked fine now after following your advise. Thanks a ton for reviewing my code and all the help/support. Highly appreciated.
Cheers
Mohamed |
|
Back to top |
|
|
km_abdullah
New User
Joined: 03 Nov 2008 Posts: 60
|
|
|
|
Hi all,
This post is to make all forum members aware of what the problem i faced and how it was solved.
The changes i made to my code posted above are -
1. Removing a space between 'RECORD TYPE=FB and LENGTH=(100)',
2. Removing of array from 'INFIELD' variable.
It ended fine after these changes.
Cheers.. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Good to hear it is working
Thank you for posting the solution - it will help someone else some other time.
Hi Gnanas,
Thanks for the extra effort
d |
|
Back to top |
|
|
|