Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to declare files in pl/1?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
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    Post subject: How to declare files in pl/1?
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    Post subject:
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    Post subject: Re: How to declare files in pl/1?
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    Post subject: Re: How to declare files in pl/1?
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    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts FTP Skip or ignore error and process ... AJAYREDDY All Other Mainframe Topics 3 Wed Sep 27, 2017 8:12 pm
No new posts Comparing 2 Files using Current time arunsoods SYNCSORT 9 Fri Sep 22, 2017 6:00 pm
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 22 Sun Aug 27, 2017 10:35 pm
No new posts Match two files using multiple keys a... santoshks1987 SYNCSORT 11 Fri Aug 18, 2017 10:50 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us