PMS Information Systems
Welcome to PMS Information Systems - IBM i (AS/400) Forum !!!

Get Answers for all your queries on IBM i (AS/400).

Declaring two files

View previous topic View next topic Go down

Declaring two files

Post  Vanithadevi on Thu Oct 01, 2009 8:27 pm

Can we declare more than one file in a CL program using DCLF?


Regards,
Vanitha.

Vanithadevi

Posts : 14
Join date : 2009-07-29
Age : 32
Location : Chennai

View user profile

Back to top Go down

Re: Declaring two files

Post  muthuraman on Thu Oct 01, 2009 8:37 pm

Yes Vanitha.we can have up to 5 DCLF statements in a CL as display files or database file.

The Declare File (DCLF) command declares one file (by name) to a Control Language (CL) program. Up to five DCLF commands are allowed in a CL program or ILE CL procedure. Each DCLF command specifies the name of a display file or database file.

muthuraman

Posts : 42
Join date : 2009-08-28

View user profile

Back to top Go down

Declaring more files

Post  Vanithadevi on Mon Oct 05, 2009 8:55 pm

Muthuraman is correct.From V5R3 We will be allowed to use more than one DCLF and a maximum of five DCLF commands. We can declare both a database file and a display file in a CL procedure and also able to process the same file more than once by declaring it multiple times.
For this we need to add a new parameter, OPNID.You must specify an identifying name for the file.

E.g:
Suppose you specify OPNID(WORKF) when declaring file WORKFILE, which has fields MBRNAME, MBRTYPE, and MBRSIZE.
DCLF FILE(WORKFILE) OPNID(WORKF)
The CL compiler will generate variables named &WORKF_MBRNAME, &WORKF_MBRTYPE, and &WORKF_MBRSIZE.

If you declare more than one file, you must use the OPNID parameter on all input-output commands: Declare File (DCLF), End Receive (ENDRCV), Receive File (RCVF), Send File (SNDF), Send/Receive File (SNDRCVF), and WAIT (Wait for input operation).

Vanithadevi

Posts : 14
Join date : 2009-07-29
Age : 32
Location : Chennai

View user profile

Back to top Go down

Re: Declaring two files

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum