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

opening copybook from program


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vidyaa

New User


Joined: 02 May 2008
Posts: 77
Location: chennai

PostPosted: Sat Apr 25, 2009 3:05 am
Reply with quote

hi,

Is that possible to open copy book in fileaid from program using rexx
Back to top
View user's profile Send private message
rakesh17684

New User


Joined: 08 Oct 2006
Posts: 61
Location: San Diego

PostPosted: Sat Apr 25, 2009 1:08 pm
Reply with quote

vidyaa,

can u elaborate the same question a bit more..
In case u want to open the Copy book from a cobol prog in view/browse mode i got a rexx macro for doing it icon_smile.gif
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: Sat Apr 25, 2009 8:30 pm
Reply with quote

Hello,

If you go ahead and post the rexx code, Vidya can reply and let us know if it does what is requested. It may help someone else with a similar requirement as well.
Back to top
View user's profile Send private message
ashishsr123

New User


Joined: 06 May 2008
Posts: 33
Location: Chennai

PostPosted: Sun Apr 26, 2009 4:15 pm
Reply with quote

Hi rakesh

Can you please post the code .i also need it.

Thanks!
Ashish
Back to top
View user's profile Send private message
rakesh17684

New User


Joined: 08 Oct 2006
Posts: 61
Location: San Diego

PostPosted: Mon Apr 27, 2009 11:11 am
Reply with quote

Sry for the delay guys.. This something i coded on the go.. what all u need to do add this to ur macro directory or ur ISPF lib.. and then save it as member with a easy member name u like ex. 'cbk' and once u are in the program place your cursor on the member and type 'cbk'

Code:

/*REXX   FOR VIEW THE COPYBOOK FROM COBOL PROG */   
                                                   
ADDRESS ISREDIT                                     
'MACRO'                                             
'(LNUM) = LINENUM' .ZCSR                           
'(LNDATA) = LINE' LNUM                             
LNDATA = STRIP(LNDATA)                             
DSPOS = POS('COPY',LNDATA)                         
IF DSPOS = 0 THEN  SIGNAL INCLUDE                   
LASTPOS = POS('.',SUBSTR(LNDATA,DSPOS+5))           
MEMBER = SUBSTR(LNDATA,DSPOS+5,LASTPOS-1)           
MEMBER = STRIP(MEMBER)                             
DSNAME = 'HLQ.DIR.COPYLIB('||MEMBER||')'  ----> THE PDS WHERE THE COPYBOOKS ARE PRESENT         
  ADDRESS ISPEXEC                                   
  /* ADDRESS ISREDIT */                             
   "BROWSE DATASET('"DSNAME"')"                     
 /* "COPY '"DSNAME"'" */                           
 EXIT                                               
 INCLUDE:                                           
 DSPOS = POS('INCLUDE',LNDATA)                     
IF DSPOS = 0 THEN  SIGNAL ERROR_MSG                 
PARSE VAR LNDATA INCLUDE DCLGEN                     
MEMBER = DCLGEN                                     
MEMBER = STRIP(MEMBER)                             
DSNAME = 'HLQ.DIR.COPYLIB('||MEMBER||')'  ----> THE PDS WHERE THE COPYBOOKS ARE PRESENT           
 ADDRESS ISPEXEC                                   
 "BROWSE DATASET('"DSNAME"')"                       
 EXIT                                               
 /* ZEDSMSG = "PRESS F3 TO GO BACK "               
 ZEDLMSG = "TO GO BACK - PLEASE PRESS F3   "       
 ADDRESS ISPEXEC "SETMSG MSG(ISRZ001)" */           
 /* DATAVAR =  '-----------------------------------'
 "ISREDIT LINE_AFTER .ZCSR = INFOLINE  (DATAVAR)"   
 DATAVAR =  '    PRESS F3 TO GO BACK    '           
 "ISREDIT LINE_AFTER .ZCSR = INFOLINE  (DATAVAR)"   
 DATAVAR =  '-----------------------------------'   
 "ISREDIT LINE_AFTER .ZCSR = INFOLINE  (DATAVAR)" */
ERROR_MSG:                                         
 /* ZEDSMSG = "CURSOR POSITION ERROR "                   
 ZEDLMSG = "PLACE THE CURSOR OVER THE COPY VERB "       
 ADDRESS ISPEXEC "SETMSG MSG(ISRZ001)" */               
    ZERRSM='CURSOR POSITION ERROR'                       
    ZERRLM= ' PLACE THE CURSOR OVER THE COPY VERB'       
    ZERRHM='*'                                           
    ZERRALRM='YES'                                       
    ADDRESS ISPEXEC 'SETMSG MSG(ISRZ002)'               
 /* DATAVAR =  'PLACE THE CURSOR OVER THE COPY VERB'     
 "ISREDIT LINE_AFTER .ZCSR = INFOLINE  (DATAVAR)"     */
EXIT                                                     
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: Mon Apr 27, 2009 11:24 am
Reply with quote

Hi Rakesh,

Thank you for posting your code icon_smile.gif

d
Back to top
View user's profile Send private message
ashishsr123

New User


Joined: 06 May 2008
Posts: 33
Location: Chennai

PostPosted: Mon Apr 27, 2009 4:50 pm
Reply with quote

Hi Rakesh,


I have changed the pds to pds where all copy books are kept.
Code:
DSNAME = 'HLQ.DIR.COPYLIB('||MEMBER||')'  ----> THE PDS WHERE THE COPYBOOKS ARE PRESENT


Now I am running the code with the following command.

Code:
tso exec 'ash.TEST.REXX(CBK)'


first I wrote the above commant(on the command line) and then placed the cursor over the copybook and hit Enter.

I get following error.
Code:
CURSOR POSITION ERROR


Kindly help to get rid of the error.
Note: I will keep the code in standard library after wards. I first want to test it keeping it in my personal PDS.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Apr 27, 2009 5:05 pm
Reply with quote

Quote:
Note: I will keep the code in standard library after wards.


when asking and having received code, people should not rely on the code provider help afterward

code is posted as a courtesy and as an example on how to proceed
never as a finalized ready to run production code
the environments are usually different, and some tailoring must be carried on

the receiver should make sure that he understands the code and it' s implications
and has enough knowledge of the language the tool is written in

the script is not that complicated to debug and modify
the message and the reason are pretty clear to me

since You are a tool developer, You should be able to find it Yourself
run with trace on and try to understand why You get the message
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Mon Apr 27, 2009 5:07 pm
Reply with quote

Quote:
Kindly help to get rid of the error


Hi Rakesh,

welcome to the land of support -
give a rookie some code and you are continually supporting it.

ashish srivastava,

after taking 5 seconds to wade thru this 'enormous' REXX Macro,
I was finally able to determine that
Quote:
CURSOR POSITION ERROR

will be displayed when the line on which you positioned your cursor did not have either
  • COPY
  • INCLUDE
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Mon Apr 27, 2009 6:44 pm
Reply with quote

ashishsr123 wrote:
Now I am running the code with the following command.

Code:
tso exec 'ash.TEST.REXX(CBK)'


first I wrote the above commant(on the command line) and then placed the cursor over the copybook and hit Enter.

I get following error.
Code:
CURSOR POSITION ERROR



This is because you are telling TSO to run an ISPF macro.

You should enter only the macro name (CBK) on the command line of the EDIT or VIEW panels.
The library 'ash.TEST.REXX' should be allocated to SYSEXEC DD.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Apr 27, 2009 6:53 pm
Reply with quote

releasing the <thing> for general use would suggest to check for proper
invocation environment

and issuing the proper messages

1) check if the ispf environment is active ( sysvar(SYSISPF) = "ACTIVE" )

2) check the return code of "ISREDIT MACRO

the manuals ..
TSO/E bookshelf for the sysvar
ISPF bookshelf for the ISREDIT

will give enough info to proceed
Back to top
View user's profile Send private message
rakesh17684

New User


Joined: 08 Oct 2006
Posts: 61
Location: San Diego

PostPosted: Mon Apr 27, 2009 7:06 pm
Reply with quote

Quote:
The library 'ash.TEST.REXX' should be allocated to SYSEXEC DD


Marso is correct..
Back to top
View user's profile Send private message
vidyaa

New User


Joined: 02 May 2008
Posts: 77
Location: chennai

PostPosted: Mon Apr 27, 2009 7:52 pm
Reply with quote

Thank you...the macro you have given will open the member from the library we specify but i need to open the copybook from the fileaid using option 8 which will show us the length of each fields form within the program...
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Mon Apr 27, 2009 8:13 pm
Reply with quote

Vidya,

Since it appears that you are having problems deciphering all the hieroglyphics of a pure copybook
(Pic clause, interpreting length based on Pic clause, numeric types, etc)
you could do a split screen or START
and access FILEAID from the other session.
That way you could see the program and the 'readable' form of the copybook.

in other words have both, instead of invoking Fileaid from within the program.

FileAid with copybooks is normally used to display a file contents.

using a third session, you could view the compile output,
which would provide you with the offsets of fields within the program W-S and Linkage.
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 -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Using API Gateway from CICS program CICS 0
No new posts DB2 Event passed to the Application P... DB2 1
No new posts How to pass the PARM value to my targ... COBOL Programming 8
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
Search our Forums:

Back to Top