Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Append records in a PDS member after running a CLIST command

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

New User


Joined: 22 Mar 2007
Posts: 57
Location: India

PostPosted: Wed Dec 03, 2008 3:26 pm    Post subject: Append records in a PDS member after running a CLIST command
Reply with quote

Requirement is -
After a particular CLIST command is executed a PDS member (member name = userid) should be updated by certain information.

My CLIST command is for opening a given member existing in a PDS (specified in command).

I had tried with the following Code:
Code:

PROC 1 MBR                                                             
/**********************************************************************/
/*                            REXX                                    */
/**********************************************************************/
IF &SYSDSN('DE00.T0000000.ECMS.CPY(&MBR)') = OK +                       
   THEN ISPEXEC VIEW DATASET('DE00.T0000000.ECMS.CPY(&MBR)')           
ELSE WRITE COMPONENT DOES NOT EXIST - &MBR                             
END                                                                     
user = userid()                                                         
MYDSN = "'DE00.THTSUTIL.ECMS.IDS("user")'"                             
"ALLOC DD(PDSID) DA("MYDSN") SHR"                                       
Queue 'line1 : Should be written in member ' user on date()             
Queue 'line2 : Should be written in member ' user at time()             
"EXECIO "Queued()" DISKW PDSID (FINIS"                                 
"FREE DD(PDSID)"                                                       
exit                                                                   


The above code is not giving any error and opens member DE00.T0000000.ECMS.CPY(MEMBER), when TSO <CLIST Command name> MEMBER is entered in command line.
But it do not write records in the PDS(DE00.THTSUTIL.ECMS.IDS) with member name = Userid of the person executing the CLIST command.

The logic of writing member in PDS DE00.THTSUTIL.ECMS.IDS works fine when executed separately without logic of opening member in PDS DE00.T0000000.ECMS.CPY
Back to top
View user's profile Send private message

Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2086
Location: Silicon Valley

PostPosted: Wed Dec 03, 2008 10:18 pm    Post subject: Reply to: Append records in a PDS member after running a CLI
Reply with quote

CLIST and rexx are two separate languages. You are mixing CLIST statements with REXX statements. If you are writing something new, you should use REXX only.
Back to top
View user's profile Send private message
Deepakgoyal2005

New User


Joined: 22 Mar 2007
Posts: 57
Location: India

PostPosted: Thu Dec 04, 2008 3:15 pm    Post subject:
Reply with quote

Can anyone suggest for what are the required changes in the above code to change entirely to REXX or CLIST and solve the purpose.
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4650
Location: Raleigh, NC, USA

PostPosted: Thu Dec 04, 2008 6:15 pm    Post subject: Reply to: Append records in a PDS member after running a CLI
Reply with quote

Let's see if I understand the process.

The user enters the TSO/E command "TSO execname MEMBER".

The exec should check for the existence of the dataset:

'DE00.T0000000.ECMS.CPY(MEMBER)'

and if OK then it should open it for a BROWSE session, otherwise a message should be displayed to the user and the exec should exit.

After the user ends the BROWSE session, another library:

''DE00.THTSUTIL.ECMS.IDS("userid")' is allocated and two lines are written to that member:

'line1 : Should be written in member 'userid' on 'date()
'line2 : Should be written in member 'userid' at 'time()

Is it just those two lines written every time, or do we need to add logic to first read any existing lines, then add two new ones to the (bottom or top)?
Back to top
View user's profile Send private message
Deepakgoyal2005

New User


Joined: 22 Mar 2007
Posts: 57
Location: India

PostPosted: Thu Dec 04, 2008 6:53 pm    Post subject:
Reply with quote

Your understanding is absolutely correct Superk.
We need to add logic to first read any existing lines, then add two new ones to the bottom.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1243
Location: Israel

PostPosted: Thu Dec 04, 2008 10:32 pm    Post subject:
Reply with quote

Snipped from TSO/E REXX Reference (In EXECIO paragraph):
Quote:
To append information to a member of a PDS, rewrite the member with the additional records added.
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4650
Location: Raleigh, NC, USA

PostPosted: Fri Dec 05, 2008 2:20 am    Post subject: Reply to: Append records in a PDS member after running a CLI
Reply with quote

Try this:
Code:

/**********************************************************************/
/*                            REXX                                    */
/**********************************************************************/
Parse Arg member
If SYSDSN("'DE00.T0000000.ECMS.CPY("member")'") = "OK" Then
  ISPEXEC VIEW DATASET('DE00.T0000000.ECMS.CPY("member")')           
Else
  Do
    Say "COMPONENT DOES NOT EXIST - "member
    Exit
  End
user = Userid()
mydsn = "''DE00.THTSUTIL.ECMS.IDS("user")'"
"ALLOC DD(PDSID) DA("mydsn") SHR REUSE"
If SYSDSN(mydsn) = "OK" Then "EXECIO * DISKR PDSID (FINIS"
Queue 'line1 : Should be written in member 'user' on 'date()             
Queue 'line2 : Should be written in member 'user' at 'time()             
"EXECIO "Queued()" DISKW PDSID (FINIS"                                 
"FREE DD(PDSID)"                                                       
exit                                                                   
Back to top
View user's profile Send private message
Deepakgoyal2005

New User


Joined: 22 Mar 2007
Posts: 57
Location: India

PostPosted: Fri Dec 05, 2008 12:38 pm    Post subject:
Reply with quote

It worked as required with only small change in syntax -

Working Code -
Code:

/*                            REXX                                    */
/**********************************************************************/
Parse Arg member                                                       
If SYSDSN("'DE00.T0000000.ECMS.CPY("member")'") = "OK" Then             
 "ISPEXEC VIEW DATASET('DE00.T0000000.ECMS.CPY("member")')"             
Else                                                                   
  Do                                                                   
    Say "COMPONENT DOES NOT EXIST - " member                           
    Exit                                                               
  End                                                                   
user = Userid()                                                         
mydsn = "'DE00.THTSUTIL.ECMS.IDS("user")'"                             
"ALLOC DD(PDSID) DA("mydsn") SHR REUSE"                                 
If SYSDSN(mydsn) = "OK" Then "EXECIO * DISKR PDSID (FINIS"             
Queue 'line1 : Should be written in member 'user' on 'date()           
Queue 'line2 : Should be written in member 'user' at 'time()           
"EXECIO "Queued()" DISKW PDSID (FINIS"                                 
"FREE DD(PDSID)"                                                       
exit                                                                   


Thanks Superk for your valuable inputs.
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
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts MQ command in option 6 of ISPF! Vignesh Sid All Other Mainframe Topics 3 Tue Sep 26, 2017 6:01 pm
No new posts How to change a string containing the... chong.zhou TSO/ISPF 6 Tue Aug 29, 2017 4:54 pm
No new posts Failure after DIR command Hank Watson All Other Mainframe Topics 2 Tue Aug 29, 2017 3:14 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us