MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

PLI/I File writing issue... !!

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
karunkallore
Beginner


Joined: 11 Dec 2004
Posts: 103
Topics: 39

PostPosted: Mon Sep 19, 2005 7:32 pm    Post subject: PLI/I File writing issue... !! Reply with quote

Hi,

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.

Please help me out !!!!

Thanks in advance,
Karun.
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Sep 20, 2005 7:17 am    Post subject: Reply with quote

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.

http://www.mvsforums.com/helpboards/viewtopic.php?t=1970&highlight=bufno

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
karunkallore
Beginner


Joined: 11 Dec 2004
Posts: 103
Topics: 39

PostPosted: Tue Sep 20, 2005 11:59 am    Post subject: Thanks !! Please help with PLISRTA behaviour.... Reply with quote

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
-----------

SORTIN DD DSN=TSTA125.T1401720.TEST10.SORTIN,
UNIT=SYSWK,DISP=(NEW,CATLG,DELETE),
SPACE=(CYL,(1,1),RLSE),
DCB=(RECFM=VB,LRECL=107,BLKSIZE=0,DSORG=PS)
SORTOUT DD DSN=TSTA125.T1401720.TEST10.SORTOUT,
UNIT=SYSWK,DISP=(NEW,CATLG,DELETE),
SPACE=(CYL,(1,1),RLSE),
DCB=(RECFM=VB,LRECL=107,BLKSIZE=0,DSORG=PS)

NOW ( Which is working )
-------

SORTIN DD DSN=TSTA125.T1401720.TEST10.SORTIN1,
UNIT=SYSWK,DISP=(NEW,CATLG,DELETE),
SPACE=(CYL,(1,1),RLSE),
DCB=(RECFM=V,DSORG=PS)
SORTOUT DD DSN=TSTA125.T1401720.TEST10.SORTOUT1,
UNIT=SYSWK,DISP=(NEW,CATLG,DELETE),
SPACE=(CYL,(1,1),RLSE),
DCB=(RECFM=V,DSORG=PS)

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.

Thanks a lot for your time.
Karun.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group