View previous topic :: View next topic
|
Author |
Message |
Amit Manas Dubey Currently Banned New User
Joined: 15 Dec 2006 Posts: 22 Location: Mumbai
|
|
|
|
Hi All,
There is an array which has been defined as below -
053900 05 :AMBS:-H OCCURS 24 TIMES
054000 INDEXED BY
054100 X-:AMBS:-H2
054200 X-:AMBS:-H.
054300 07 :AMBS:-H-DELQ
054400 PIC X.
054500 07 :AMBS:-H-BAL
054600 PIC X.
I want to put AMBS-H-DELQ ocurrences 1-12 in one String. I used the following lines of code, but this isnt working -
PERFORM VARYING X-AMBS-H FROM 1 BY 1 UNTIL X-AMBS-H = 12
STRING FASR-CSR-PYMT-HISTORY DELIMITED BY SIZE
AMBS-H-DELQ (X-AMBS-H) DELIMITED BY SIZE
INTO FASR-CSR-PYMT-HISTORY
END-PERFORM
Pls suggest. FASR-CSR-PYMT-HISTORY is the field where i want to dump my output.
Best regards,
Amit. |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Amit ,
Your code is NOT easily understandable. Remeber to use 'code' tag atleast from your next post.
If you want to move n occurnce from a table, why dont you 'move' directly using reference modification. |
|
Back to top |
|
|
Ajay Baghel
Active User
Joined: 25 Apr 2007 Posts: 206 Location: Bangalore
|
|
|
|
what error are you getting at run time?
I think you need to change the perform condition to below:
Quote: |
UNTIL X-AMBS-H = 12 |
-Ajay |
|
Back to top |
|
|
Ajay Baghel
Active User
Joined: 25 Apr 2007 Posts: 206 Location: Bangalore
|
|
|
|
oh forgot to change the condition. It should be:
Quote: |
UNTIL X-AMBS-H > 12 |
-Ajay |
|
Back to top |
|
|
Amit Manas Dubey Currently Banned New User
Joined: 15 Dec 2006 Posts: 22 Location: Mumbai
|
|
|
|
HI Ajay
I am getting spaces in the output variable.
@ Murmohkh1 - Can you pls let me know how can I use reference modification for the same ?
Rgds,
Amit. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
each time you perform this:
Code: |
STRING FASR-CSR-PYMT-HISTORY DELIMITED BY SIZE
AMBS-H-DELQ (X-AMBS-H) DELIMITED BY SIZE
INTO FASR-CSR-PYMT-HISTORY
|
you are stringing FASR-CSR-PYMT-HISTORY into itself. there will be no room for anything else.
either use the pointer option within the perform, or simply without a perform:
Code: |
MOVE SPACES (or initialize) TO FASR-CSR-PYMT-HISTORY
STRING AMBS-H-DELQ (1) DELIMITED BY SIZE
AMBS-H-DELQ (2) DELIMITED BY SIZE
AMBS-H-DELQ (3) DELIMITED BY SIZE
...
AMBS-H-DELQ (12) DELIMITED BY SIZE
INTO FASR-CSR-PYMT-HISTORY
END-STRING
|
|
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
As an alternative to the STRING verb, give this a try -
Code: |
03 WS-POS PIC 9(008) BINARY.
MOVE SPACES TO FASR-CSR-PYMT-HISTORY (1:).
MOVE 1 TO WS-POS.
SET X-AMBS-H TO 1.
PERFORM UNTIL X-AMBS-H > 12
MOVE AMBS-H (X-AMBS-H) TO FASR-CSR-PYMT-HISTORY (WS-POS:LENGTH OF AMBS-H (1))
ADD LENGTH OF AMBS-H (1) TO WS-POS
SET X-AMBS-H UP BY 1
END-PERFORM.
|
Regards,
Bill |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Please substitute -
AMBS-H-DELQ for AMBS-H
and
LENGTH OF AMBS-H-DELQ (1) for LENGTH OF AMBS-H (1).
I misread your post and thought you needed the entire group moved (AMBS-H) as opposed to a group of elementary items (AMBS-H-DELQ) which are subordinate to the group.
Regards,
Bill |
|
Back to top |
|
|
Amit Manas Dubey Currently Banned New User
Joined: 15 Dec 2006 Posts: 22 Location: Mumbai
|
|
|
|
Thanks guys !!!!
Both the approaches work correctly and yield desired results.
Thanks again.
Regards,
Amit. |
|
Back to top |
|
|
|