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
 

 

how can we Declare DYNAMIC ARRAy in PL/1?

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

New User


Joined: 21 Apr 2006
Posts: 11
Location: Chennai

PostPosted: Mon Apr 24, 2006 1:58 pm    Post subject: how can we Declare DYNAMIC ARRAy in PL/1?
Reply with quote

hi
can anyone tell me what is Dynamic array? how can we declare in PL/1?

if possile give me example.


Thanks and Regards
haris
Back to top
View user's profile Send private message

MSMITHUK

New User


Joined: 31 Mar 2005
Posts: 5
Location: London

PostPosted: Mon Apr 24, 2006 9:12 pm    Post subject:
Reply with quote

Hi,

I am not sure if this is the answer you are looking for but there is an option called REFER which can be used on arrays that allows variables for the size of the array.
I have included the page from the Language Reference, hope it helps

===========================================
A self-defining structure or union contains information about its own fields, such as the length of a string. A based structure or union can be declared to manipulate this data. String lengths, array bounds, and area sizes can all be defined by variables, known as the refer object, declared within the structure or union. When the structure or union is allocated (by either an ALLOCATE statement or a LOCATE statement), the value of an expression is assigned to the refer object variable. For any other reference to the structure or union, the value of the refer object is used.

The REFER option is used in the declaration of a based structure or union to specify that, on allocation of the structure or union, the value of an expression is assigned to the refer object and represents the length, bound, or size of another variable in the structure or union. The syntax for a length, bound, or size with a REFER option is shown in the following diagram.

Regards,
Moira



________________________________________________________________________
| |
| >>__expression__REFER__(member-variable)____________________________>< |
| |
|________________________________________________________________________|



expression The value of this expression defines the length, bound, or size of the member when the structure or union is allocated (using ALLOCATE or LOCATE). The expression is evaluated and converted to FIXED BINARY (31,0). Any variables used as operands in the expression must not belong to the structure or union containing the REFER option.
Back to top
View user's profile Send private message
ARIVUMR

New User


Joined: 21 Apr 2006
Posts: 11
Location: Chennai

PostPosted: Tue Apr 25, 2006 11:01 am    Post subject: Re: how can we Declare DYNAMIC ARRAy in PL/1?
Reply with quote

Thank u moria , i will go through it .

regards
hari
Back to top
View user's profile Send private message
vish75

New User


Joined: 11 Jan 2006
Posts: 1
Location: kol

PostPosted: Wed Apr 26, 2006 5:10 pm    Post subject: @hari
Reply with quote

I have used another method in which i needed an array whose size is being defined dynamically. look at the sample code below. It might help you..

dcl CONTENTLENGTH fixed bin(31);
dcl wparam char(*) ctl;

CONTENTLENGTH = 500; /* or any value depending on program logic */

if allocn(wparam) = 1 then free wparam;

allocate wparam char(CONTENTLENGTH);

wparam = teststrg; /* test strg may be a char string */

p.s - pls correct me if i m wrong.

regards vishy
Back to top
View user's profile Send private message
ARIVUMR

New User


Joined: 21 Apr 2006
Posts: 11
Location: Chennai

PostPosted: Fri Apr 28, 2006 11:53 am    Post subject:
Reply with quote

hi vishy ,

Thank u , i am aking about dynamic array i think u have mentioned vaiable length character string whcih is dynamically created. i need dynamic ARRAY .
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 Dynamic array request/response contai... Suja.Sai CICS 2 Tue Jan 24, 2017 11:37 am
No new posts REXX DB2: Dynamic allocation of DB2.D... BHAS CLIST & REXX 3 Mon Dec 19, 2016 8:26 pm
No new posts Creating a dynamic sort card in JCL u... ChitraChhabra DFSORT/ICETOOL 4 Wed Aug 03, 2016 6:15 pm
No new posts Need help on SQL Dynamic WHERE Clause subratarec DB2 12 Sat Jul 16, 2016 3:11 pm
No new posts Unstring list of values into an array. Roshnii COBOL Programming 8 Mon Jun 27, 2016 6:25 pm


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