IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to declare files in pl/1?


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rajjesht
Warnings : 1

New User


Joined: 03 Aug 2005
Posts: 20

PostPosted: Wed Apr 05, 2006 5:50 pm
Reply with quote

Hello
Can anyone say how to declare files in pl/1 and also how to specify the files in the jcl .
Back to top
View user's profile Send private message
banu

New User


Joined: 09 Aug 2005
Posts: 8
Location: Chennai

PostPosted: Wed May 24, 2006 10:56 am
Reply with quote

- File program - for writing into a file:
WRITFILA: /* TO WRITE A FILE */
PROC OPTIONS(MAIN) REORDER ;
DCL RDFIL FILE RECORD OUTPUT;
DCL
SYSPRINT FILE PRINT EXTERNAL ;
DCL 1 INSURANCE,
3 INSURER,
5 INS_NAME CHAR(20),
5 AGE PIC '(2)9',
3 COMPANY,
5 CO_NAME CHAR(25),
5 PRD_CODE CHAR(3),
5 SUMASSURED PIC '(5)9',
3 FILLER CHAR(25);

DCL EOF CHAR(1) INIT('Y');

OPEN FILE (RDFIL);

DO WHILE (EOF = 'Y');
GET SKIP LIST(INSURANCE.INSURER.INS_NAME);
GET SKIP LIST(INSURANCE.INSURER.AGE);
GET SKIP LIST(INSURANCE.COMPANY.CO_NAME);
GET SKIP LIST(INSURANCE.COMPANY.PRD_CODE);
GET SKIP LIST(INSURANCE.COMPANY.SUMASSURED);
WRITE FILE (RDFIL) FROM (INSURANCE);
GET SKIP LIST (EOF);
END; /* DO WHILE (EOF = Y) */

CLOSE FILE (RDFIL);

END; /* PROGRM END */


--In JCL the name of the file which you mentioned in the program should be given as step name.

For eg:
//WRTFIL EXEC NBNSDL1R,
// PPGM=WRITFIL,
.......
//RDFIL DD DSN=XXX.XXX,DISP=SHR
Back to top
View user's profile Send private message
rajjesht
Warnings : 1

New User


Joined: 03 Aug 2005
Posts: 20

PostPosted: Thu May 25, 2006 9:31 pm
Reply with quote

Hi banu thank you for your reply
Back to top
View user's profile Send private message
dinosaurio

New User


Joined: 12 Jan 2006
Posts: 1

PostPosted: Wed May 31, 2006 3:11 am
Reply with quote

Here aditional information


DECLARATION
File name can be from 1 to 7 characters long.
File attributes include
Type of transmission. (STREAM or RECORD)
Direction of transmission. (INPUT, OUTPUT or UPDATE)
Physical environment of the file.(Record size, blksize etc..)
DCL INVEN FILE INPUT STREAM ENV (options).
FILE attribute
It specifies that the identifier being declared is a file.
It can be implied if other file attributes are present in the DECLARE that enable the compiler to deduce the file attribute. e,g,
DCL BILLING INPUT STREAM ENV(F BLKSIZE(150));

INPUT/OUTPUT attribute
One of these attributes must be specified either in the declare statement or in the open statement.
INPUT is the default attribute unless the file has the PRINT attribute.
STREAM Attribute
It specifies that data items are accessed by GET or PUT statements that they are continuous stream. There are three forms of stream.
LIST Directed GET LIST, PUT LIST
EDIT Directed GET EDIT, PUT EDIT
DATA directed GET DATA, PUT DATA
Opposite of stream is record. If neither is not specified STREAM is assumed

ENVIRONMENT Attribute.
It can be omitted if equivalent information is given in the JCL.
The options applicable to STREAM files are
Record form
Record size.
ENV(F BLKSIZE(80)) Specifies
Record type is fixed
Each record is 80 byte long
PRINT Attribute
Added for stream files associated with a printer.
Applies only to files with STREAM and OUTPUT attributes.
It causes the initial byte of each record of the associated data set to be reserved for printer control character (which does not appear in the printout) through the use of PAGE, SKIP, LINE.

DEFAULT or PREDEFINED FILES
SYSIN is the default standard input file.
SYSPRINT is the default standard output file.
GET LIST(A,B) is equal to GET FILE(SYSIN) LIST(A,B)
PUT LIST(A,B) is equal to PUT FILE(SYSPRINT) LIST(A,B)
SYSIN and SYSPRINT file names and their attributes need not be declared for IBM implementations. The default attributes are:
SYSIN FILE STREAM INPUT ENV(F BLKSIZE(80))
SYSPRINT FILE STREAM OUTPUT PRINT ENV(V BLKSIZE(129))
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
Search our Forums:

Back to Top