View previous topic :: View next topic
|
Author |
Message |
sripallu
New User
Joined: 11 May 2005 Posts: 12 Location: India
|
|
|
|
Hello gurus,
We are having an uregetn requirement for generating a loop
the requirement is
we are generating reports from RPT59A to RPT59Z
after Z the program gets into infinite loop....
so we need to start from RPT59AA to RPT59ZZ
Current scenario
declarations
01 LETTER-INCREMENT-AREA.
03 INCREMENT-AREA PIC 9(4) COMP.
03 INCREMENT-AREA-R REDEFINES INCREMENT-AREA.
05 FILLER PIC X.
05 LETTER-INC PIC X.
implementation
MOVE 0 TO INCREMENT-AREA
MOVE GAT-PROCESS-NAME(GAT-RESULT:1) TO LETTER-INC
ADD 1 TO INCREMENT-AREA
MOVE LETTER-INC TO GAT-PROCESS-NAME(GAT-RESULT:1)
we need the same as to generate RPT59AA to RPT59ZZ
Thanks in Advance
SriPallu
Currently it loops when the A thru Z are used. The new fix should still begin with A and then go through Z, then begin with double alpha AA thru ZZ. |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
sripallu,
I don't understand what the code is that you have supplied. Please give the complete code that is failing with an explanation of any inbound variables used to control the loop.
As I understand you requirements, you need to produce reports named 'RPT59A' - 'RPT59Z' then 'RPT59AA' - 'RPT59AA'. Is the problem within the loop in constucting the report name? How to go from 'PRT59A' to RPT59B', then C etc.?
Please come back,
Dave |
|
Back to top |
|
|
martin9
Active User
Joined: 01 Mar 2006 Posts: 290 Location: Basel, Switzerland
|
|
|
|
hy sripallu,
as i see it,
you need a decimal to hexadecimal conversion,
to get the two last letters. just if the hexadecimal values
are from 0A to 0Z, you only want the last letter...
the code you provided, is not clear, how you want to do this.
but this should be really no problem,
maybe you can deliver more details...
i.e. waht is GAT-PROCESS-NAME?? and
what is it's value, it probably changes...
martin9 |
|
Back to top |
|
|
sripallu
New User
Joined: 11 May 2005 Posts: 12 Location: India
|
|
|
|
hello david and martin
thanks for ur replies
@david here is the code that converts thr report from RPT59A to RPT59B
MOVE 0 TO INCREMENT-AREA
MOVE GAT-PROCESS-NAME(GAT-RESULT:1) TO LETTER-INC
ADD 1 TO INCREMENT-AREA
MOVE LETTER-INC TO GAT-PROCESS-NAME(GAT-RESULT:1)
@martin
GAT-PROCESS-NAME contains the location the reports are generated like
work01.hemout.rpt59A
the GAT-RESULT in above code takesa value of 21 and get the last character of GAT-PROCESS-NAME ..
hope i am clear |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
Quote: |
MOVE 0 TO INCREMENT-AREA
MOVE GAT-PROCESS-NAME(GAT-RESULT:1) TO LETTER-INC
ADD 1 TO INCREMENT-AREA
MOVE LETTER-INC TO GAT-PROCESS-NAME(GAT-RESULT:1)
|
Please give us the definitions/relationship between LETTER-INC and INCREMENT-AREA
Adding 1 to a display letter value does not necessarily result in the next letter.
Check this link to the EBCDIC Collating Sequence
Also, when you say you want to generate reports RPT59A ? RPT59Z then RPT59AA ? RPT59ZZ do you want reports ID?s RPT59AA, RPT59BB?. Or RPT59AA, RPT59AB?RPT59BA, RPT59BB?.
Dave |
|
Back to top |
|
|
sripallu
New User
Joined: 11 May 2005 Posts: 12 Location: India
|
|
|
|
the first one david the sequence would be like below
RPT59A,RPT59B,RPT59C,........RPT59Z,RPT59AA,RPT59AB,RPT59AC,.......RPT59BA,RPT59BB,RPT59BC........RPT59ZZ..
i got the logic but its generating like RPT59AA,RPT59BA,..
my move statement is not working as i expected
MOVE GAT-PROCESS-NAME(GAT-RESULT+1:1) TO WS-BETA-LETTER
the stmt above is not working
is thr any alternate way of incrmenting the GAT-RESULT with out using another varible
( i mean by any arthemetic operators)
the LETTER-INC and INCREMENT-AREA are declared like this
01 LETTER-INCREMENT-AREA.
03 INCREMENT-AREA PIC 9(4) COMP.
03 INCREMENT-AREA-R REDEFINES INCREMENT-AREA.
05 FILLER PIC X.
05 LETTER-INC PIC X.
as we increase the INCREMENT-AREA the letetr will autmatically increase due to REDFEFINES clause |
|
Back to top |
|
|
|