I am reading in a field on an input file as a PIC S9(3) COMP-3 field and simply want to move that to another PIC S9(3) COMP-3 field. However I am having problems trying to accomplish this...Can anyone help?
I am only trying to move an input packed field to an output packed field. However cannot move the entire group because I am adding fields in the output.
WORKING STORAGE.
Hayesb2,
I can't see anything wrong with the code that you have posted, it seems to work OK to me. I would therefore suggest you discount this from your thinking and look elsewhere. Have a look instead at the input file and see if it is really Comp-3 which if you were looking at the value +100 would look something like:
010
00C
in hex mode. Also check that it's in the place in the file that you think it is.
Let us know how you get on, and as Dimandja says, any error messages will be helpful.
hth
Marc
From what you've shown us, it should work. One possibility, and IMHO, the most likely:
The input data doesn't contain what you think.
On the other hand, I don't think you can start your Working Storage at level 10. That may be your problem.
You don't tell use How "it won't work", so it's difficult to pinpoint the problem. You also don't tell us what your environment is: Mainframe, PC, Compiler provider, or std, etc. So I can't advise you about how to look at the data format, etc.
I just reread your posts and a couple things seem to stand out:
When you say "I am only trying to move an input packed field to an output packed field. However cannot move the entire group because I am adding fields in the output.", are you saying that you want the group LVL-INPUT moved to LVL-OUTPUT, but you also want to insert/preserve INFO-OUTPUT where indicated?
If that is your intention, then I am assuming that you are new to COBOL and programming in general (I am sorry if am off base here - wouldn't be the first time), and this would be your solution:
If you want group LVL-INPUT moved to group LVL-OUTPUT, then you should ascertain that the structures of the two groups are cohesive (these two here are not the same): for example,
If you moved LVL-INPUT into LVL-OUTPUT, the content of KEY-SEQ-INPUT would end up in INFO-OUTPUT, and who knows what KEY-SEQ-OUTPUT would receive. If that is not what you want, do not use a group move. Do exactly as you say: move KEY-SEQ-INPUT to KEY-SEQ-OUTPUT and you are fine.
Your example should work provided the level 10's are snippets of code that are defined under a level 01.
What platform (i.e. Mainframe or PC) are you running. If PC then what COBOL compiler are you running. I did have problems with the move of numeric fields on some early, older PC Compilers but most of the problems have been resolved with current technologies.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.