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

Is there any keyword like VARIABLE in PL1


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 184
Location: India

PostPosted: Tue Sep 01, 2009 9:41 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Sep 01, 2009 10:19 am
Reply with quote

Hello,

See if the info here is what you are looking for. . .
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/ibm3lr60/19.70

At the top of the page is a link to "IBM Manuals". Suggest you look in the appropriate manual(s) before searching the web (Google) icon_wink.gif
Back to top
View user's profile Send private message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 184
Location: India

PostPosted: Tue Sep 01, 2009 10:34 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Sep 01, 2009 10:45 am
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Sep 01, 2009 10:47 am
Reply with quote

confirm Dick' s comment icon_cool.gif
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Tue Sep 01, 2009 10:50 am
Reply with quote

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?

Code:
A = 5;
B = A;


Can you tell me what the result of this is?
Back to top
View user's profile Send private message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 184
Location: India

PostPosted: Tue Sep 01, 2009 10:52 am
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Sep 01, 2009 11:04 am
Reply with quote

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 icon_evil.gif
makes code dificult to read, I had to read it two times to analyze it

why do You worry about the how icon_question.gif , 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
View user's profile Send private message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 184
Location: India

PostPosted: Tue Sep 01, 2009 11:06 am
Reply with quote

Hi,

For Enrico's comment:
Quote:
confirm Dick' s comment

There is only one situation.

For Prins question
Quote:
Code:

A = 5;
B = A;

Here A and B both will have value 5.
Back to top
View user's profile Send private message
notonly4u

New User


Joined: 26 Apr 2005
Posts: 87
Location: Hyderabad

PostPosted: Tue Sep 01, 2009 12:02 pm
Reply with quote

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
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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Variable Output file name DFSORT/ICETOOL 8
No new posts Moving Or setting POINTER to another ... COBOL Programming 2
No new posts parsing variable length/position data... DFSORT/ICETOOL 5
No new posts Masking variable size field - min 10 ... DFSORT/ICETOOL 4
Search our Forums:

Back to Top