View previous topic :: View next topic
|
Author |
Message |
Achroo
New User
Joined: 07 Jan 2008 Posts: 7 Location: noida
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
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 |
|
|
Douglas Wilder
Active User
Joined: 28 Nov 2006 Posts: 305 Location: Deerfield IL
|
|
|
|
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 |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
By the way COBOL is numbered in columns 1 - 6 not 1 - 7! |
|
Back to top |
|
|
|