Posted: Wed Jun 14, 2006 8:20 am Post subject: calling DFSORT from a PLI program
Members,
I am trying to call DFSORT from a PLI program and i am unable to get my desired results:
I am getting my program getting successfully compiled but when i run the program i am unable to get desired output.
I am passing INCLUDE CONDITION in SORTCNTL statement and in the program specifying the SORT conditions,Record statement as well Maximum Storage size also.
My Code:
[code:1:b527796c2f]
/*PROGRAM TO SORT USING PLI */
/*********************************************************************/
/* PROGRAM NAME : SORTPGM */
/* DESCRIPTION : PROGRAM TO SORT */
/* INPUT : INPUT DATASET */
/* OUTPUT : OUTPUT DATASET */
/*********************************************************************/
SORTPGM:PROCEDURE OPTIONS(MAIN);
DCL INP FILE INPUT RECORD,
OUT FILE OUTPUT RECORD;
DCL 1 MASTER_RECORD,
5 BTITLE CHAR(75),
5 LASTNAME CHAR(15),
5 FIRSTNAME CHAR(15),
5 PUBLISHER CHAR(04),
5 DEPT CHAR(05),
5 NUMBER CHAR(05),
5 CNAME CHAR(25),
5 ILNAME CHAR(15),
5 IINITIAL CHAR(02),
5 NUMSTOCK BIN FIXED(31),
5 NUMSOLD BIN FIXED(31),
5 PRICE BIN FIXED(31);
DCL 1 MASTER_OUT_RECORD CHAR(173) INIT(' ');
OPEN FILE(INP) INPUT,
FILE(OUT) OUTPUT;
DCL RETURN_CODE FIXED BIN(31,0);
DCL MAXSTOR FIXED BIN(31,0);
UNSPEC(MAXSTOR)='00000000'B||UNSPEC('MAX');
DCL IN_EOF BIT(1) INIT('0'B);
ON ENDFILE(INP) IN_EOF = '1'B;
READ FILE(INP) INTO(MASTER_RECORD);
DO WHILE (
Joined: 26 Nov 2002 Posts: 12380 Topics: 75 Location: San Jose
Posted: Wed Jun 14, 2006 8:34 am Post subject:
Quote:
ICE067I K INVALID PARAMETER IN JCL EXEC PARM OR INVOKED PARM LIST
ICE000I I - CONTROL STATEMENTS FOR 5740-SM1, DFSORT REL 14.0 - 12:20 ON TUE JUN
INCLUDE COND=(110,4,EQ,C'ENGL')
ICE146I J END OF STATEMENTS FROM SORTCNTL - PARAMETER LIST STATEMENTS FOLLOW
SORT FIELDS=(1,75,CH,A)
RECORD TYPE=F,LENGTH=(173)
OPTION MAINSIZE=MAX,SORTDD=SORT
ICE018A 3 INVALID FORMAT
ICE052I J END OF DFSORT
SORT FAILED
mfuser,
You are NOT passing the format of the data on the include statement. Your include statement should be
Thanks for your reply and i am learning a lot from your replies.But i am unable to get any data in my output dataset.As i had mentioned earlier i am not coding a proper write statement :
MASTER_OUT_RECORD is not getting populated any values as a result it will be blanks only.How can i form my output record after calling CALL PLISRTA i mean what would be the move statement like.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Wed Jun 14, 2006 2:28 pm Post subject:
I'm not a PL/I programmer, but as I understand it, PLISRTA reads all of the records from SORTIN, sorts them, and writes all of the sorted records to SORTOUT. I don't think you can mix READ and WRITE statements with the use of PLISRTA as you're trying to do.
Perhaps the following documentation will help you understand the various PLISRTx routines and how they are used:
You are correct in your wordings that PLISRTA reads in the SORTIN Dataset and produces SORTOUT Dataset and we should not be coding any file concepts as Mfuser is doing so in the pgm.
Mfuser try this code:
[code:1:8f23e01f4e]
/*PROGRAM TO SORT USING PLI */
/*********************************************************************/
/* PROGRAM NAME : SORTPGM */
/* DESCRIPTION : PROGRAM TO SORT */
/* INPUT : INPUT DATASET */
/* OUTPUT : OUTPUT DATASET */
/*********************************************************************/
SORTPGM:PROCEDURE OPTIONS(MAIN);
DCL 1 MASTER_RECORD,
5 BTITLE CHAR(75),
5 LASTNAME CHAR(15),
5 FIRSTNAME CHAR(15),
5 PUBLISHER CHAR(04),
5 DEPT CHAR(05),
5 NUMBER CHAR(05),
5 CNAME CHAR(25),
5 ILNAME CHAR(15),
5 IINITIAL CHAR(02),
5 NUMSTOCK BIN FIXED(31),
5 NUMSOLD BIN FIXED(31),
5 PRICE BIN FIXED(31);
DCL RETURN_CODE FIXED BIN(31,0);
DCL MAXSTOR FIXED BIN(31,0);
UNSPEC(MAXSTOR)='00000000'B||UNSPEC('MAX');
CALL PLISRTA(' SORT FIELDS=(1,75,CH,A) ',
' RECORD TYPE=F,LENGTH=(173) ',
MAXSTOR,
RETURN_CODE);
IF RETURN_CODE _________________ Shekar
Grow Technically
Joined: 26 Nov 2002 Posts: 12380 Topics: 75 Location: San Jose
Posted: Wed Jun 14, 2006 3:04 pm Post subject:
Frank and shekhar have already provided the answer. I suggest that you go thru this link which explains in detail with examples of invoking sort via PLI
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum