I want to move the first occurance of a PE group (all the fields) into a local flat field and I’m having trouble with the syntax. I’ve seen the following in another program on our system:
MOVE MC-DATA(4470/1.#W-MC-DATA) TO #MC-DATA-S
In the above example #MC-DATA-S is a flat, A38. The reference to line 4470 is a GET. I’ve tried the same syntax in my program using a different PE and I get the following error -
NAT0112 Invalid use of group name.
This is in structured mode, by the way. The only difference I can see is that in the program where this seems to be working in the Define Data, the database fields are defined with format and length. I don’t generally apply format and length to database field definition.
Any help would be appreciated. I could, of course, move this the “hard” way, field by field, but I thought it might be more interesting to find out what I’m doing wrong with this approach.
How is MC-DATA defined in the View? My guess is that it is a REDEFINE of the Periodic Group which is probably an array of A38 “buckets”.
You cannot move a Group (user defined or Periodic) to a single field.
Could it be that because the format and length definitions are included it’s not being used as a part of the view but as a separate, flat field?
Thanks, Steve. Actually, you were my first Natural instructor in Vermont in 1999. I’m not in Vermont anymore, but still consult with them and work on their system.
MC-DATA is an MU, not a PE. Given the REDEFINE, it should have been a PE. However, if you try to move a real PE (which is a group) to a single field, you will get that error.
You can either redefine the PE in your data area to a single field or redefine your target single field to the same elements as the PE to make the move happen.
It looks like MC-DATA is an MU field, not a PE. The REDEFINEs are basically creating special names for the first occurrence of MC-DATA. Thus, MC-COMP-CODE is a single field, not an array.
Try referencing MC-COMP-CODE (2); you should get an error message.
Take a look at the DDM for PMIO321. You should see MC-DATA as an MU not a PE.