Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Is there any keyword like VARIABLE in PL1

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

Active User


Joined: 10 Aug 2009
Posts: 158
Location: India

PostPosted: Tue Sep 01, 2009 9:41 am    Post subject: Is there any keyword like VARIABLE in PL1
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

Site Director


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

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

Hello,

See if the info here is what you are looking for. . .
http://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: 158
Location: India

PostPosted: Tue Sep 01, 2009 10:34 am    Post subject:
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

Site Director


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

PostPosted: Tue Sep 01, 2009 10:45 am    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10276
Location: italy

PostPosted: Tue Sep 01, 2009 10:47 am    Post subject: Reply to: Is there any keyword like VARIABLE in PL1
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: 1028
Location: Oostende, Belgium

PostPosted: Tue Sep 01, 2009 10:50 am    Post subject:
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: 158
Location: India

PostPosted: Tue Sep 01, 2009 10:52 am    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10276
Location: italy

PostPosted: Tue Sep 01, 2009 11:04 am    Post subject: Reply to: Is there any keyword like VARIABLE in PL1
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: 158
Location: India

PostPosted: Tue Sep 01, 2009 11:06 am    Post subject:
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    Post subject:
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    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 Can I traverse a STEM variable? chong.zhou CLIST & REXX 5 Wed May 31, 2017 3:54 pm
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us