PL/I

PL/I

PL/I

 View Only
  • 1.  Dynamically Allocate File

    Posted Fri October 23, 2015 06:45 AM

    Hi ,

    I'm trying to Dynamicaly Allocate File via OPEN FILE (OUT) TITLE('DSN(XXXXX.XXXXX.MILTEST),LRECL(80)'); 

    File is created but the record size is default value; I tried env variable and alternate name with DD_DDNAME but keep getting

    UNDEFINEDFILE condition was raised ABENDU4038

     

    thanks

    MilanMlynarcik


  • 2.  Re: Opening a File for output

    Posted Sat October 24, 2015 10:51 AM

    That looks like z/OS.

    You'll need to look in the Programming Guide.

    Robin400


  • 3.  Re: Dynamically Allocate File

    Posted Sat October 24, 2015 07:14 PM

    Hi Milan,

    I'd use BPXWDYN to do the allocate. Then open the allocated file. Separating allocate from open make diagnosis a bit simpler.

    Here are some links to documentation for BPXWDYN :

    The doc contains examples of how to fetch and call it from PL/I.

    Good luck.

    Frank

     

    Frank_O_Myers@IBM


  • 4.  Re: Dynamically Allocate File

    Posted Tue October 27, 2015 09:45 AM

    Hi,

    I use code like this:

    DCL OUT FILE RECORD OUTPUT  ENV ( VB RECSIZE (120)      );

     OPEN FILE (OUT)  TITLE                                             
        ('DSN('!!CURRENT_DSN!!')'                         
         !!',NEW,CATALOG'                                 
         !!',TRACKS'                                      
         !!',SPACE(50,1)'                                 
         !!',DATACLAS(RETP0007)'                          
         );                       

    You can use a lot more DSN-Options (STORCLAS(whatever), MGMTCLAS(whatever), ..). Have a look in PL/1 Programming Guide.

     

    Regards,

    Tom

     

    TomStadler


  • 5.  Re: Dynamically Allocate File

    Posted Tue October 27, 2015 12:29 PM

    Hello Milan,

    that's not a correct PL/1 Syntax, you produced. The apostrophe in front of "TSMOS.COMPILER..." terminates the string. So the compiler uses TSMOS.COMPILER.MILTEST as a reference to a variable.
    Use TITLE (' << string with all the options - one of them is DSN(dsname) - others are NEW, CATALOG, and so on --->')

    OPEN FILE (OUT) TITLE
    (    'DSN(TSMOS.CIMPILER.MILTEST),NEW,CATALOG,TRACKS,SPACE(50,1)'  );

    should work.

    In my example CURRENT_DSN is a variable (CHAR (48) VAR) variable which is filled before the OPEN.

    I attached a stripped version of  my log-writer to illustrate how we use it (DSN is bulit with a fix suffix and some timestamp-related parts).

    Note: in the installation where I'm currently working "!!" (two exclamation marks) are used for concatenation (not the common "||"s). Probably you've to change my sample-code on your system. 

    Regards,

    Tom

     

     

    TomStadler


  • 6.  Re: Dynamically Allocate File

    Posted Tue October 27, 2015 12:36 PM

    thanks a lot Tom, it worked, much appreciated

    MilanMlynarcik