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
 

 

Insert a Format using Rexx Macro in Cobol Program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> TSO/ISPF
View previous topic :: :: View next topic  
Author Message
arpita soni

New User


Joined: 19 Jun 2007
Posts: 3
Location: mumbai

PostPosted: Fri May 21, 2010 12:14 pm    Post subject: Insert a Format using Rexx Macro in Cobol Program
Reply with quote

Hi,
Using Rexx(macro) , I want to insert a Format like this in the cobol program: Kindly assist me with the code how can i acheive this:-
Format:-

*****************************
Identification Division.
*****************************
Environment Division.
*****************************
Back to top
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Fri May 21, 2010 12:26 pm    Post subject:
Reply with quote

Please explain exactly what it is that you want to achieve.

Where do you want to insert these 5 lines. Are not the division names unique in a program and should not be used more than once. Far more detail is required before anybody will bother to get out of bed to even look at the request.
Back to top
View user's profile Send private message
arpita soni

New User


Joined: 19 Jun 2007
Posts: 3
Location: mumbai

PostPosted: Fri May 21, 2010 12:33 pm    Post subject: Reply to: Insert a Format using Rexx Macro in Cobol Program
Reply with quote

The above said lines will have more lines something to add like Author details, comment section which says what is the program name, program created date , version etc.. When a user will run this macro automatically the this Flower Box will be generated and the developer will not be formatting the data.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Fri May 21, 2010 12:42 pm    Post subject: Reply to: Insert a Format using Rexx Macro in Cobol Program
Reply with quote

OK... start writing some code and come back if You face problems.

looks like for You assist with the code means ... write the code for me

search the forums ( ISPF ) or GOOGLE for EDIT MACROS EXAMPLES
and You will find lots of examples to meditate on
Back to top
View user's profile Send private message
GaganGarg

Active User


Joined: 31 Mar 2010
Posts: 132
Location: India

PostPosted: Tue Jun 08, 2010 5:47 pm    Post subject:
Reply with quote

Try this:

Code:

/*REXX*/                                                               
"ISREDIT MACRO (ARGS)"                                                 
"ISPEXEC CONTROL ERRORS RETURN"                                         
INPUT="OPERA12.TEST(REXX)"                                             
"ALLOCATE DDN(FILE1) DSN('"INPUT"') SHR REUSE"                   
"EXECIO * DISKR FILE1(STEM A. FINIS)"                             
"FREE DDN(FILE1)"                                                 
DO I = 1 TO A.0                                                     
   LINE1= A.I                                                           
   "ISREDIT LINE_BEFORE 1 = (LINE1)"                                   
END


Lines that you want to inser must be present in a PS file or a PDS member. here i used a PDS OPERA12.TEST and member name is REXX.

Good to see you at this forum site icon_biggrin.gif
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Jun 08, 2010 5:57 pm    Post subject:
Reply with quote

i realize that I am 'old school',
but I have not coded a COBOL program from scratch in about 20 years.

I start with an existing program
that compiles,
that complies with site standards
and then just delete what I don't need/want and change what is required.

GaganGarg,

your MACRO will work,
but if I may make a couple of suggestions.
1. if there are no arguments, don't use ARGS
2. the lines could have been 'hard coded' in your REXX,
thus saving the need for an allocate/execio for a file that always needs to exist.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Jun 08, 2010 5:59 pm    Post subject:
Reply with quote

GaganGarg wrote:
Try this:
Did YOU try it before posting ?
Back to top
View user's profile Send private message
GaganGarg

Active User


Joined: 31 Mar 2010
Posts: 132
Location: India

PostPosted: Tue Jun 08, 2010 6:01 pm    Post subject:
Reply with quote

Quote:
i realize that I am 'old school',
but I have not coded a COBOL program from scratch in about 20 years.

I start with an existing program
that compiles,
that complies with site standards
and then just delete what I don't need/want and change what is required.



I also never code from scratch. But everybody's organisations/clients standards may vary. so requirements may change from person to person.

Quote:

your MACRO will work,
but if I may make a couple of suggestions.
1. if there are no arguments, don't use ARGS
2. the lines could have been 'hard coded' in your REXX,
thus saving the need for an allocate/execio for a file that always needs to exist.


Thanks Dick Brenholtz for your valuable suggestions. I had just provided the draft version but i will keep in mind the above things. Thanks
Back to top
View user's profile Send private message
GaganGarg

Active User


Joined: 31 Mar 2010
Posts: 132
Location: India

PostPosted: Tue Jun 08, 2010 6:03 pm    Post subject:
Reply with quote

Yes i tried
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Jun 08, 2010 6:12 pm    Post subject:
Reply with quote

Well unfortunately, as the OP has failed to answer any of the questions that were asked of him, it would be a little difficult to try and offer any solution based on what we already know.

@GaganGarg
Sorry to question your testing of that, after a longer look it should work.
Another little tip
Why read the file when
Code:
"ISREDIT COPY 'OPERA12.TEST(REXX)' BEFORE "1
will give the same results.
Back to top
View user's profile Send private message
GaganGarg

Active User


Joined: 31 Mar 2010
Posts: 132
Location: India

PostPosted: Tue Jun 08, 2010 6:25 pm    Post subject:
Reply with quote

Yes... we can use. It doesn't come to my mind. Whatever come to my mind, i tried. You guys are expeirnced persons and you can suggest better solutions. Thanks for helping in improving my skills. icon_biggrin.gif

Quote:

@GaganGarg
Sorry to question your testing of that, after a longer look it should work.


Not a problem at all. After a longer look, one can say that the above macro will not work if the PDS member( to which we want to insert the lines of code) is empty. for that we have to insert one line (may be a blank line) manually before running this macro. I should had mentioned this. apologies for this.

But same is the case with "ISREDIT COPY 'OPERA12.TEST(REXX)' BEFORE "1 with this line of rexx code also.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Jun 08, 2010 6:42 pm    Post subject:
Reply with quote

try changing the 1 to .zf
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Jun 08, 2010 6:45 pm    Post subject:
Reply with quote

GaganGarg wrote:
Not a problem at all. After a longer look, one can say that the above macro will not work if the PDS member( to which we want to insert the lines of code) is empty. for that we have to insert one line (may be a blank line) manually before running this macro. I should had mentioned this. apologies for this.

But same is the case with "ISREDIT COPY 'OPERA12.TEST(REXX)' BEFORE "1 with this line of rexx code also.

Code:
"ISREDIT COPY 'OPERA12.TEST(REXX)' AFTER "0
will work for an empty dataset.

Here's the code that I used and tested before - it deletes the data currently in a dataset and then adds a subset from a master file.
Code:
"ISREDIT MACRO"                                       
"ISPEXEC CONTROL ERRORS RETURN"                       
"ISPEXEC VGET (STFRM ENDAT)"                           
"ISREDIT X ALL"                                       
"ISREDIT DELETE X ALL"                                 
"ISREDIT COPY 'DEV.SORTED.MASTER' AFTER "0 STFRM ENDAT
Back to top
View user's profile Send private message
GaganGarg

Active User


Joined: 31 Mar 2010
Posts: 132
Location: India

PostPosted: Tue Jun 08, 2010 6:52 pm    Post subject:
Reply with quote

Quote:


try changing the 1 to .zf



it works for both if dataset is empty or not.

Thanks Dick.
Back to top
View user's profile Send private message
sai.bhagavatula

New User


Joined: 05 Mar 2007
Posts: 10
Location: Sydney, Australia

PostPosted: Tue Jun 22, 2010 12:31 pm    Post subject:
Reply with quote

Btw, Mr. Gagangarg, if you further want to explore the ways of doing this, and learn more, SKELS can be useful.Skeletons are very simple and extremely useful in sitatustion like this.

Following sample rexx receives the skel name and output PDS as parameters and loads the skel into the output PDS with member name as tempjob.

Code:

ARG SKEL DSN                                                         
Tempdsn = Strip(Translate(DSN," ","'"))                             
Address TSO "Alloc F(ISPFILE) Dsn('"tempdsn"') Shr Reus"             
Address Ispexec "Ftopen "                                           
Address Ispexec "Ftincl " Skel                                       
Address Ispexec "Ftclose Name("tempjob")"                           
Address TSO "Free F(ISPFILE) "                                       


Note: This is a sample I created for a specific purpose, but you can modify this to do the loading into the member you are working on etc.,

Have fun!
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 -> TSO/ISPF All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts IMS BMP program causes 878 system abend Artemk IMS DB/DC 7 Tue Nov 22, 2016 8:26 pm
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm


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