Milan Mlynarcik
Milan Mlynarcik

Reputation: 1

pl/i enterprise dynamically allocate file

I'm trying to dynamically 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

Upvotes: 0

Views: 574

Answers (1)

travis thorne
travis thorne

Reputation: 1

Try this to create a new file in Enterprise PL/I:

Dcl theLrecl = 42;
 Dcl userDataset char(44) init('USER.DATASET');
dcl fileTitle char(88);                           
fileTitle ='DSN('||trim(userDataset)||'),NEW,CYL,SPACE(1,1),KEEP,LRECL('||theLrecl||')';       

Put Skip List('fileTitle=',trim(fileTitle));  /* optionally show the title for debugging purposes */    
dcl tempFile file print;                          
OPEN FILE(tempFile) title(trim(fileTitle));       

Note: the 'title' string can not contain whitespace; so trim it to be sure.
More details are at http://www-01.ibm.com/support/docview.wss?uid=isg1PK74015

Oops, misread question; here is the snippet from knowledge centre regarding LRECL;

LRECL The LRECL option is the same as the RECSIZE option.

LRECL (n) If LRECL is not specified and not implied by a LINESIZE value (except for TYPE(FIXED) files, the default is 1024.

RECSIZE The RECSIZE option specifies the length, n, of records in the data set.

RECSIZE 512 ( n ) - For regional and fixed-length data sets, RECSIZE specifies the length of each record in the data set; for all other data set types, RECSIZE specifies the maximum length records may have.

Full details of both options appear in chapter 6 : using datasets and files of "Enterprise PL/I for z/OS - Programming Guide Version 4 Release 4"

Upvotes: 0

Related Questions