View previous topic :: View next topic
|
Author |
Message |
satish.ms10
Active User
Joined: 10 Aug 2009 Posts: 184 Location: India
|
|
|
|
Hi,
I have following code in my PL1 program.
Code: |
DCL ((INFILE INPUT,(CNTLFIL,OUTFILE) OUTPUT) RECORD,
FILENAME VARIABLE,
REPORT PRINT STREAM) FILE;
|
Do we have any VARIABLE keyword in PL1? If yes, please let me know the functionality of "VARIABLE".
I did some reasearch in google for this but i did not get any clue.
Thanks in advance! |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
Back to top |
|
|
satish.ms10
Active User
Joined: 10 Aug 2009 Posts: 184 Location: India
|
|
|
|
Hi Dick,
Thanks for your quick reply. FILEDDWORD function will return attributes of a file.
But in my case it is not the case. I have following code in a if condition.
Code: |
DO;
CNTLFIL_COUNT = CNTLFIL_COUNT + 1;
FILENAME = CNTLFIL;
END;
|
Could you please let me know what is the result of FILENAME = CNTLFIL; statement?
Because of this statement I am getting confusion. I do not have mainframe access to check this program. I need to analyze/work on downloaded text files. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hi Sati,
Unfortunately, i don't "speak" pl/i.
Is this possibly an assignment of the value of one variable to another? Are both defined somewhere in the code?
This newest post does not resemble the original. . . Are there 2 different situations? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
confirm Dick' s comment |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
satish.ms10 wrote: |
But in my case it is not the case. I have following code in a if condition.
Code: |
DO;
CNTLFIL_COUNT = CNTLFIL_COUNT + 1;
FILENAME = CNTLFIL;
END; |
Could you please let me know what is the result of FILENAME = CNTLFIL; statement? |
Ever considered to RTFM, rather than asking others to do it for you?
Can you tell me what the result of this is? |
|
Back to top |
|
|
satish.ms10
Active User
Joined: 10 Aug 2009 Posts: 184 Location: India
|
|
|
|
Hi Dick,
Here I am giving code for declaration
Code: |
DCL ((INFILE INPUT,(CNTLFIL,OUTFILE) OUTPUT) RECORD,
FILENAME VARIABLE,
REPORT PRINT STREAM) FILE;
|
Same program is having following code in an IF condition.
Code: |
DO;
CNTLFIL_COUNT = CNTLFIL_COUNT + 1;
FILENAME = CNTLFIL;
END;
|
Here my question is CNTLFIL is a logical file name, how it is assinged to FILENAME.
Here what is FILENAME? what is the result of "FILENAME = CNTLFIL;" statement?
Your efforts are appreciable. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
Here my question is CNTLFIL is a logical file name, how it is assinged to FILENAME.
Here what is FILENAME? what is the result of "FILENAME = CNTLFIL;" statement? |
first a comment on the coding style...
it would not have passed any decent assurance;
never use one dcls for multiple files
makes code dificult to read, I had to read it two times to analyze it
why do You worry about the how , that' s a PL1 internal businness
the result ( intended as consequence ) of the assignment
is that FILENAME when used for I/O operations will point to the CNTLFIL dataset |
|
Back to top |
|
|
satish.ms10
Active User
Joined: 10 Aug 2009 Posts: 184 Location: India
|
|
|
|
Hi,
For Enrico's comment:
Quote: |
confirm Dick' s comment |
There is only one situation.
For Prins question
Here A and B both will have value 5. |
|
Back to top |
|
|
notonly4u
New User
Joined: 26 Apr 2005 Posts: 87 Location: Hyderabad
|
|
|
|
Hi Sati,
Here FILENAME is declared as a file variable usually coded to pass the files to sub routines.
The external entry to the sub programs will be declared with this file variable.
For eg, if your program is MAINPGM (PL1 Main program) and calling SUBPGM (PL1 sub routine), then the entry statement will be coded in MAINPGM as
DCL SUBPGM EXT ENTRY (FILE VARIABLE, POINTER);
Then while calling the program you can call by,
CALL SUBPGM(FILENAME, PNTR_PGM1);
In your case the file CNTLFIL will be passed to the suproutine for processing. You can read or write the file in SUBPGM which is opened in MAINPGM.
Should you have any questions pls let me know.
Regards
Tanden |
|
Back to top |
|
|
|