Hi,
In interview today one question was asked if
WS-VAR1 is ABCDE and
WS-VAR2 is 123
How will you get output as below-:
WS-VAR3 AB12CD3
My answer was
MOVE WS-VAR1(1:2) TO WS-VAR3
MOVE WS-VAR2(1:2) TO WS-VAR3
MOVE WS-VAR2(3:2) TO WS-VAR3
MOVE WS-VAR2(3:1) TO WS-VAR3
I know this is wrong and it was stupid of me to think that output will be AB12CD3 but I am looking for the correct answer, any suggestions are welcome!
WS-VAR3 output as AB12CD3
-
- Posts: 43
- Joined: Tue Dec 07, 2010 5:32 pm
- Skillset: COBOL,JCL,DB2,VSAM,CA7
- Referer: Google
-
- Global moderator
- Posts: 3805
- Joined: Tue Jan 25, 2011 12:02 am
- Skillset: Easytrieve Plus, Cobol, Utilities, that sort of stuff
- Referer: Google
Re: WS-VAR3 output as AB12CD3
Your output will be "3" in the left-most byte and the rest "padded" with space.
To get what you want with reference-modification, you also need to use reference-modification on the receiving field, otherwise each MOVE is going to overwrite the same data.
You don't need reference-modification. You can just do it with data-definitions.
To get what you want with reference-modification, you also need to use reference-modification on the receiving field, otherwise each MOVE is going to overwrite the same data.
You don't need reference-modification. You can just do it with data-definitions.
-
- Posts: 93
- Joined: Thu Mar 22, 2012 10:02 am
- Skillset: COBOL
CICS
JCL
DB2
VSAM
IMS - Referer: INTERNET
Re: WS-VAR3 output as AB12CD3
1 You can use reference variable in the receiving field as well.
2. Another way is to redefine the first variables and move the corresponding redefined parts.
2. Another way is to redefine the first variables and move the corresponding redefined parts.
-----------------------------------------
As long as you think you are a student, you are doing well.
The day you consider yourself as the master of the game..........well
As long as you think you are a student, you are doing well.
The day you consider yourself as the master of the game..........well
-
- Similar Topics
- Replies
- Views
- Last post
-
- 3
- 2765
-
by willy jensen
View the latest post
Tue Jun 29, 2021 1:36 pm
-
- 2
- 2248
-
by Pedro
View the latest post
Tue Feb 27, 2024 4:44 am
-
- 11
- 3639
-
by willy jensen
View the latest post
Thu Oct 15, 2020 1:25 am
-
-
CICS program output different when ran using CEDF.
by rogerstrycova » Sun Oct 03, 2021 4:52 pm » in CICS - 2
- 1541
-
by Robert Sample
View the latest post
Sun Oct 03, 2021 8:22 pm
-
-
-
Output of rexx is coming in UPPER Case only
by arya_starc » Thu Jan 12, 2023 3:41 pm » in CLIST & REXX - 4
- 2340
-
by sergeyken
View the latest post
Fri Jan 13, 2023 1:44 am
-