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
 

 

troubleshooting !! How to create multiple members in PDS ?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
pravin1234jd

New User


Joined: 31 May 2010
Posts: 11
Location: India

PostPosted: Fri Dec 30, 2011 12:22 am    Post subject: troubleshooting !! How to create multiple members in PDS ?
Reply with quote

Hi guys,

My requirement: I want to create multiple members is a PDS file, Name of the member will be decided dynamically in the program.

My code:
Below para will be called in a loop with different value of varibale "MEMBER "


Code:
ALLOCATE_MEM:

CODECOMP = TESTDATA.CODE
                                                                   
COMP_MFILE = CODECOMP || "(" || MEMBER || ")"                 
FILE_EXISTS  = SYSDSN(CODECOMP_MFILE)                               
SAY 'FILE_EXISTS  : ' FILE_EXISTS     

IF FILE_EXISTS   /= 'OK' THEN DO                                         
   "ALLOC F(DD1) DS("COMP_MFILE")  SHR REU"                       
   SAY "ALLOCATION COMP_MFILE : " RC COMP_MFILE               
END
                                                                   
HDR_OUTPUT1.1 = " TEST DATA REPORT"                               
                                                                   
"EXECIO * DISKW DD1 (STEM HDR_OUTPUT1."                             
SAY " RC : " RC

RETURN


This code is working fine for allocating first member but when I am trying to allocate the second member I am getting below error

IKJ56861I FILE DD1 NOT UNALLOCATED, DATA SET IS OPEN
ALLOCATION COMP_MFILE : 12
Back to top
View user's profile Send private message

Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1746
Location: Bloomington, IL

PostPosted: Fri Dec 30, 2011 12:46 am    Post subject: Re: troubleshooting !! How to create multiple members in PDS
Reply with quote

pravin1234jd wrote:
Hi guys,

My requirement: I want to create multiple members is a PDS file, Name of the member will be decided dynamically in the program.

My code:
Below para will be called in a loop with different value of varibale "MEMBER "


Code:
ALLOCATE_MEM:

CODECOMP = TESTDATA.CODE
                                                                   
COMP_MFILE = CODECOMP || "(" || MEMBER || ")"                 
FILE_EXISTS  = SYSDSN(CODECOMP_MFILE)                               
SAY 'FILE_EXISTS  : ' FILE_EXISTS     

IF FILE_EXISTS   /= 'OK' THEN DO                                         
   "ALLOC F(DD1) DS("COMP_MFILE")  SHR REU"                       
   SAY "ALLOCATION COMP_MFILE : " RC COMP_MFILE               
END
                                                                   
HDR_OUTPUT1.1 = " TEST DATA REPORT"                               
                                                                   
"EXECIO * DISKW DD1 (STEM HDR_OUTPUT1."                             
SAY " RC : " RC

RETURN


This code is working fine for allocating first member but when I am trying to allocate the second member I am getting below error

IKJ56861I FILE DD1 NOT UNALLOCATED, DATA SET IS OPEN
ALLOCATION COMP_MFILE : 12

You need to close and free the data set by
Code:
"EXECIO 0 DISKW (FINIS"
"FREE FI(DD1)"


(Alternatively, you could change your existing EXECIO statement to close the data set after writing to it:
Code:
"EXECIO * DISKW DD1 (STEM HDR_OUTPUT1. FINIS"


Although it is ISPF rather Rexx, you may want to check out the ISPF LMM* services.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Dec 30, 2011 1:37 am    Post subject:
Reply with quote

this is a line of code which will always be false (NOT = 'OK'):

Code:
FILE_EXISTS  = SYSDSN(CODECOMP_MFILE)
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1224
Location: Israel

PostPosted: Fri Dec 30, 2011 5:47 pm    Post subject:
Reply with quote

Quote:
Code:
CODECOMP = TESTDATA.CODE
Code:
HDR_OUTPUT1.1 = " TEST DATA REPORT"
"EXECIO * DISKW DD1 (STEM HDR_OUTPUT1."

may lead to problems too.
Better do:
Code:
CODECOMP = "TESTDATA.CODE"
and
Code:
HDR_OUTPUT1.1 = " TEST DATA REPORT"
"EXECIO 1 DISKW DD1 (FINIS STEM HDR_OUTPUT1."
or
Code:
HDR_OUTPUT1. = ""
HDR_OUTPUT1.1 = " TEST DATA REPORT"
"EXECIO * DISKW DD1 (FINIS STEM HDR_OUTPUT1."
or
Code:
HDR_OUTPUT1.1 = " TEST DATA REPORT"
HDR_OUTPUT1.2 = ""
"EXECIO * DISKW DD1 (FINIS STEM HDR_OUTPUT1."
Back to top
View user's profile Send private message
pravin1234jd

New User


Joined: 31 May 2010
Posts: 11
Location: India

PostPosted: Tue Jan 03, 2012 7:50 pm    Post subject:
Reply with quote

Thanks all for your reply.

I understood where I was making mistake. I was not closing the member when i was writing into it. i used the FINIS and its working properly now.
Back to top
View user's profile Send private message
marlm

New User


Joined: 08 Apr 2008
Posts: 2
Location: Brazil

PostPosted: Wed Feb 12, 2014 12:37 am    Post subject: I have same issue but FINIS does not work as I want
Reply with quote

I need to write lines one by one and using FINIS it closes the file, therefore on next iteration it will not add a new line on member but delete the previous line and overwrite it. Any other suggestion ? Any way of write a member without allocate the dataset?

http://ibmmainframes.com/viewtopic.php?t=57113&highlight=rexx+pds+allocation
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1746
Location: Bloomington, IL

PostPosted: Wed Feb 12, 2014 1:09 am    Post subject: Re: I have same issue but FINIS does not work as I want
Reply with quote

marlm wrote:
I need to write lines one by one and using FINIS it closes the file, therefore on next iteration it will not add a new line on member but delete the previous line and overwrite it. Any other suggestion ? Any way of write a member without allocate the dataset?

Please do not add your query to a thread that has been dormant any length of time, certainly not for two years; start a new thread instead and, if if seems necessary, add a link to the older thread(s).

As you see by the previous discussion, using the FINIS keyword on an EXECIO statement closes the data set or member; therefore, if you intend to write more data to it, do not close it (i.e., use the FINIS keyword). Note that you can append to a PS data set by giving it a status of MOD when allocating, but there is no way to do likewise for a member of a PDS(E); you read the whole thing into and write it out again.

As you will realize if you think about, a data set cannot be written to (or indeed read from) without its being allocated to the program. There are ways of doing this that don't look like a TSO ALLOCATE command, but they amount to the same thing in the end.
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 -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Rexx to create GDG by scanning JJ result krish.deepu CLIST & REXX 5 Tue Oct 25, 2016 5:32 pm
No new posts How can we create a flat file in JAVA... rakesh.v18 Java & MQSeries 7 Fri Sep 23, 2016 10:46 pm
No new posts Converting multiple VB files to FB fi... Viswanath Reddy JCL & VSAM 6 Mon Aug 08, 2016 11:49 pm
No new posts Execute multiple DB2 Load commands in... faizm DB2 4 Wed Aug 03, 2016 12:53 pm
This topic is locked: you cannot edit posts or make replies. JCL MULTIPLE STEP EXECUTION QUERY Susanta JCL & VSAM 18 Sat Jul 30, 2016 1:17 pm


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