I have a PLI routine. Here in the following code i see in the put list statement that that the record written is say type 'A' ( i.e second loop IF SUBSTR(CD_TAG,1,2) = 'NS') . But finally in the SORTIN file ( Physical file ) , i see as a different record type written 'B' , which is actually a record written is another loop ( i.e first one with code IF SUBSTR(CD_TAG,1,2) = 'NU' ). The source of 'A' and 'B' are from a FB, Record length 90 and Block size 27990 file.
The SORTIN file is VB and record lenghth 107 and blocksize 27998.
Also this sortin file is opened and closed multiple times in the code. The first cases where it is opened, written and closed all goes fine. This is the last open , write and close.
Code
------
Code:
OPEN FILE(SORTIN) OUTPUT;
DO WHILE (EOF_CUSTDESC_FILE = '0');
IF SUBSTR(CD_TAG,1,2) = 'NU' THEN DO;
CALL E_042_TAG_TBL_SEARCH;
IF SW_TAG_USED = 'N' THEN DO;
TR_TYPE = 30;
TR_CODE = VR_CODE;
TR_TAG = CD_TAG;
TR_DESC = CD_LONG_DESC;
UPC_COUNT = UPC_COUNT + 1;
WRITE FILE(SORTIN) FROM(TR_RECORD);
END;
END;
ELSE IF SUBSTR(CD_TAG,1,2) = 'NS' THEN DO;
CALL E_042_TAG_TBL_SEARCH;
IF SW_TAG_USED = 'N' THEN DO;
TR_TYPE = 40;
TR_CODE = VR_CODE;
TR_TAG = CD_TAG;
TR_DESC = CD_LONG_DESC;
SUBTT_COUNT = SUBTT_COUNT + 1;
PUT SKIP LIST('TR_RECORD---------- ');
PUT SKIP LIST(TR_RECORD);
WRITE FILE(SORTIN) FROM(TR_RECORD);
END;
END;
After the sort file is written then PLISRTA is called to sort this file to SORTOUT ( of same Specification as SORTIN ).
Is it some thing to do with buffer's in PL/I. I gave a a BUFNO=20 in DCB of JCL the first process of wrting of SORTIN went fine. Then when the next time ( i.e the last time it openend SORTIN to write files where currently i am facing the issue ) it went sown with a system abend of S002 with RC of 18.
I am at my wits end as i see in put list in SYSOUT the record 'A' coming out correctly and finally in the SORTIN file it is some other record 'B.
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Tue Sep 20, 2005 7:17 am Post subject:
Karunkallore,
When you are re-writting a variable block file you need to consider populating the length of the record. For variable block file I would also suggest a read with READ filename INTO layout. READ filename moves the file pointer in the buffer such that the data-record overlays the next file record. The INTO option causes a move of the data from the buffer to the variable/structure specified, applying normal MOVE rules.
Check this link which explains about the BUFNO issues with Variable block files.
Posted: Tue Sep 20, 2005 11:59 am Post subject: Thanks !! Please help with PLISRTA behaviour....
Thanks a Lot Kolsu. Also i removed the LRECL and BLKSIZE from the JCL and just gave RECFM=V and DSORG=PS and it went fine. Do not know the reason but i guess in the PLISRTA this format was used.
CALL PLISRTA(' SORT FIELDS=(5,4,BI,D,10,5,BI,A) ',
' RECORD TYPE=V',
20000000,
RET_CODE);
The JCL changes:
--------------------
EARLIER
-----------
Note : Please note the difference in the DCB parameters.
The changes i made was with pure luck do not know a valid explanation except that PLISRTA has V for RECORD TYPE. It would be kind enough if some one can enlighten me with the real reason. ALso if some one can suggest that anything can be done in program to avoid the JCL changes.
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