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 

PL1: open file(XXX) title('yyyy')

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


Joined: 25 May 2005
Posts: 59
Topics: 20

PostPosted: Tue Nov 04, 2008 11:01 am    Post subject: PL1: open file(XXX) title('yyyy') Reply with quote

Hello boys!

Sorry to bother you but I've a really strange problem using a file in a PL1 program

On my workstation I can use such PL1 program:

Code:

 geo: PROC OPTIONS(MAIN);
 
 
    DCL FIN             FILE RECORD INPUT;   
    DCL TESTO              CHAR(1000)VAR; 
       
   OPEN FILE(FIN) TITLE('/geo.txt');
   
   READ FILE(FIN)INTO(TESTO);
   
   put skip list('FIRST RECORD: ',TESTO);
   
   CLOSE FILE(FIN);

 END geo;


where the file geo.txt is in the same directory of my exe. Obviously the program just read th afirst line in the geo.txt file and "print" it Smile

Now let's translate on our OS390.... the problem is that my file geo.txt is now a sequential file (suppose named FUSP.MY.DATASET), and I DON'T want to associate in the JCL, I really want it fixed in my load..

I supposed I could use something like:

Code:

 geo: PROC OPTIONS(MAIN);
 
 
    DCL FIN             FILE RECORD INPUT;   
    DCL TESTO              CHAR(1000)VAR; 
       
   OPEN FILE(FIN) TITLE('FUSP.MY.DATASET');
   
   READ FILE(FIN)INTO(TESTO);
   
   put skip list('FIRST RECORD: ',TESTO);
   
   CLOSE FILE(FIN);

 END geo;


But when I run the program I get an :

Code:
IBM204I  'ONCODE'=0084  'UNDEFINEDFILE' CONDITION RAISED             
   NO DD STATEMENT ('ONFILE'= FIN)                                   
   IN STATEMENT 16 AT OFFSET +000164 IN PROCEDURE WITH ENTRY GEO


How can I do that?

I use this simple step like:

Code:
//PPFN027  EXEC PGM=PPFN027                                             
//         INCLUDE MEMBER=STTPLI                                       
                 
//SYSPRINT DD   SYSOUT=* 
//SYSIN    DD  *                                                       
/*   



Any idea? Probably is something really simple, in the TITLE, but i don't know how to define it.......and in the manual I can't find any example ...

Thank you for all help!!!!

Max Very Happy
_________________
Maxisnowhere
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Tue Nov 04, 2008 3:57 pm    Post subject: Reply with quote

TITLE refers to the DDNAME that you want to use. You cannot specify a dataset name. You can specify a dataset name with dynamic allocation which needs an external dynamic allocation routine.

You probably should not try and hardcode your datasetname ina ny case - if the name changes you have to change the program.
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
maxisnowhere
Beginner


Joined: 25 May 2005
Posts: 59
Topics: 20

PostPosted: Wed Nov 05, 2008 1:55 am    Post subject: Reply with quote

Hi Nic,

it is right that I shoudn't hardcode the DSN in the code, but my goal is to write a procedure that I can use batch and tp (moreover from other system via CICS or wrapped in a stored procedure). In these procedure I need to read data from an external file and I don't want to add this file in every job (actually the problem is for the tp call at the procedure ...)

Thank you,
Max
_________________
Maxisnowhere
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Wed Nov 05, 2008 12:09 pm    Post subject: Reply with quote

Under IMS your file has to be a "database" ie a GSAM file accessed by IMS routines, under CICS I do not know for sure but I think it should be accessed by the CICS routines and under batch by the PL/1 routines so you would need 3 routines anyway.

You may be able to design it such that you have the requisite file access modules doing nowt more than reading the file and then calling a commom routine to process the data.
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
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