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
 

 

Increment COBOL line numbers using REXX

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

New User


Joined: 07 Jan 2008
Posts: 7
Location: noida

PostPosted: Tue Jul 22, 2008 1:29 am    Post subject: Increment COBOL line numbers using REXX
Reply with quote

I want to make tools such that which simply fetches data in first 7 columns and increment it by one, from start position to end position.

e.g
Input

m/f numbering 1234567........................80
.A 200000 cobol line
20000 cobol line
30000 cobol line
.B cobol line


expected output


m/f numbering 1234567........................80
.A 200000 cobol line
20000 200001 cobol line
30000 200002 cobol line
.B 200003 cobol line

that is from A to B my rexx program would increase the number by one
and give me that output


thanks
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10257
Location: italy

PostPosted: Tue Jul 22, 2008 1:40 am    Post subject: Reply to: increment numbering
Reply with quote

Quote:
I want to make tools.....

OK, go ahead, what is the problem?
things to remember when posting
Back to top
View user's profile Send private message
Pedro

Senior Member


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

PostPosted: Tue Jul 22, 2008 1:42 am    Post subject: Reply to: increment numbering
Reply with quote

Please clarify... do you want to run the tool from within the ISPF editor?

And if is for the editor, you need to learn how to code editor macros. See the ISPF Editor manual. At least read about the MACRO, and LINE instructions.

And it is not clear that you know rexx that much... you will need to study the TSO/E REXX Reference.
Back to top
View user's profile Send private message
Douglas Wilder

Active User


Joined: 28 Nov 2006
Posts: 305
Location: Deerfield IL

PostPosted: Tue Jul 22, 2008 2:15 am    Post subject:
Reply with quote

I wrote an edit macro some time ago that does a similar function in a slightly different way.
Code:
/* REXX EDITOR MACRO INCR BY DOUGLAS WILDER OF AIC                   */
/* USE CC CC TO MARK LINES THEN ENTER COMMAND "INCR COL LEN"         */
/* NUMBER IN THE FIRST LINE MARKED WILL BE INCREMENTED IN NEXT LINES */
                                                                       
ADDRESS "ISREDIT" "MACRO (COLMN,LN) NOPROCESS"                         
ADDRESS "ISREDIT" "PROCESS DEST RANGE C M"                             
                                                                       
IF LN = "" THEN DO                                                     
    SAY "MISSING PARAMETERS"                                           
    SAY "USE CC CC TO MARK LINES"                                     
    SAY "INCR COL LENGTH"                                             
    SAY "THE NUMBER IN THE INDICATED COL IN THE FIRST LINE MARKED"     
    SAY "WILL BE INCREMENTED IN NEXT LINES"                           
    EXIT                                                               
END                                                                   
                                                                       
ADDRESS "ISREDIT" "ISREDIT" "(CMD)   = RANGE_CMD"                     
ADDRESS "ISREDIT" "ISREDIT" "(FIRST) = LINENUM .ZFRANGE"               
ADDRESS "ISREDIT" "ISREDIT" "(LAST)  = LINENUM .ZLRANGE"
                                                         
ADDRESS "ISREDIT" "(DATALN) = LINE (FIRST)"             
CNTR = SUBSTR(DATALN,COLMN,LN) + 1                       
DO CURRLN = FIRST + 1 TO LAST                           
   ADDRESS "ISREDIT" "(DATALN) = LINE (CURRLN)"         
   DATA1 = SUBSTR(DATALN,1,COLMN - 1)                   
   DATA2 = COPIES("0", LN - LENGTH(CNTR)) || CNTR       
   DATA3 = SUBSTR(DATALN, COLMN + LN)                   
   DATALN = DATA1 || DATA2 || DATA3                     
   ADDRESS "ISREDIT" "LINE (CURRLN) = (DATALN)"         
   CNTR = CNTR + 1                                       
END                                                     
                                                         
EXIT                                                     
This edit macro called INCR uses cc cc to indicate the lines to increment. It requires 2 parameters the column and the length of the number to be incremented. In your case I believe that the column would be 1 and the length 7. See if this will fit your needs or you may modify it any way you would like to.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Jul 22, 2008 4:09 am    Post subject:
Reply with quote

By the way COBOL is numbered in columns 1 - 6 not 1 - 7!
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. Need help on If condition continuatio... ashok_uddaraju CLIST & REXX 4 Fri May 19, 2017 8:55 am
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am
No new posts Cobol upgrade - source code missing f... gthmrj IBM Tools 1 Wed Apr 26, 2017 6:04 pm


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