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

how to define a varing length output record variable


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

New User


Joined: 27 May 2010
Posts: 47
Location: da lian.china

PostPosted: Tue Jun 29, 2010 11:52 am
Reply with quote

In PLI programe, if I want to write data to output file, I have to declare a variable that have the same length with the output file's length that have been defined in the JCL, then I can write the data from this variable to the output file.
The problem is I want to define a variable whose length is according to the parameter from the input file, how can I do this.

eg:
when input file's parameter =120
then output record variable's length=120

when input file's parameter =60
then output record variable's length=60
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue Jun 29, 2010 5:49 pm
Reply with quote

Can you not use LIKE= in the JCL to do it for you
Back to top
View user's profile Send private message
robert-ohlen

New User


Joined: 01 Jun 2007
Posts: 11
Location: Soiron

PostPosted: Wed Jun 30, 2010 12:41 am
Reply with quote

are you obliged to define the file in the JCL?
if this is not the case, it is possible to use the ENV statement file and dynamically set the file using OPEN TITLE
Back to top
View user's profile Send private message
liying

New User


Joined: 27 May 2010
Posts: 47
Location: da lian.china

PostPosted: Wed Jun 30, 2010 7:00 am
Reply with quote

expat wrote:
Can you not use LIKE= in the JCL to do it for you


I am sorry, I can not understand you very well.
How can I use LIKE=?
Would kindly pls explain it more exactly?
Back to top
View user's profile Send private message
liying

New User


Joined: 27 May 2010
Posts: 47
Location: da lian.china

PostPosted: Wed Jun 30, 2010 7:02 am
Reply with quote

robert-ohlen wrote:
are you obliged to define the file in the JCL?
if this is not the case, it is possible to use the ENV statement file and dynamically set the file using OPEN TITLE


I am really very sorry that I know very few about ENV statement.
Would you kindly pls explain how to use it more specifically?
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: Wed Jun 30, 2010 8:51 am
Reply with quote

Hello,

Quote:
How can I use LIKE=?
Would kindly pls explain it more exactly?

LIKE is a JCL parameter and as such can be found in the JCL Language Reference (available via the "IBM Manuals" link at the top of the page).

Similarly, info about ENV can be found in the pl/i programming guide (also available via the "IBM Manuals" link).

The flashlight/tubelight near the top left is the search feature for the manual.

If you find something that is not clear in the documentation, post what you found and your doubt. Someone will be able to clarify.
Back to top
View user's profile Send private message
liying

New User


Joined: 27 May 2010
Posts: 47
Location: da lian.china

PostPosted: Wed Jun 30, 2010 9:06 am
Reply with quote

dick scherrer wrote:
Hello,

Quote:
How can I use LIKE=?
Would kindly pls explain it more exactly?

LIKE is a JCL parameter and as such can be found in the JCL Language Reference (available via the "IBM Manuals" link at the top of the page).

Similarly, info about ENV can be found in the pl/i programming guide (also available via the "IBM Manuals" link).

The flashlight/tubelight near the top left is the search feature for the manual.

If you find something that is not clear in the documentation, post what you found and your doubt. Someone will be able to clarify.



Thank you for your help.I have find them out from the IBM Manual.
But I don't think these two ways can solve my problem.But still I feel many thanks for your guide.

And at the same time, my problem have been solved by the following mathod. If it can be for your only slightly value of reference, I will be very happy.

DCL OUTPUT_RECORD CHAR(10000) VARYING;
WRITE FILE(OUTPUT1) FROM(OUTPUT_REOCRD);


JUST TO DECLARE THE OUTPUT_REOCRD TO BE VARYING,then it can be write to an output file in any length smaller than '10000'.
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: Wed Jun 30, 2010 9:30 am
Reply with quote

Good to hear it is working - thank you for posting your solution icon_smile.gif

Quote:
If it can be for your only slightly value of reference, I will be very happy.
Yes, your solution will help another someday icon_smile.gif

Good luck,

d
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 Store the data for fixed length COBOL Programming 1
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top