Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

redefines or something else

Status
Not open for further replies.

gbtech

Technical User
Mar 7, 2001
2
US
I am coding a cross-walk between two file formats that differ slightly. I need to move data in one field 4 spaces to the right and fill the vacated spaces with character space. Is this the easiest way?

05 PAT-NO-HLDR PIC X(11).

05 EV-PAT-NO.
10 EV-PAT-NO PIC X(17).
10 EVFILLER PIC X(8).
05 IBC-PAT-NO REDEFINES EV-PAT-NO.
10 NAIC-CODE PIC X(4).
10 IBC-PAT-NO PIC X(21).


400-MOVE.
MOVE EV-PAT-NO TO PAT-NO-HLDR.
MOVE SPACES TO NAIC-CODE.
MOVE PAT-NO-HOLDER TO IBC-PAT-NO.


Will this work? Is ther a 'better' way to accomplish this?
 
Hi GB,

What you did looks ok to me if you want to truncate the low order 4 bytes of the field. I'm sure your pic x(11) for hldr is a typo. There are other ways but yours is just fine.

Good luck, Jack.
 
Thanks. I haven't done this since '85 and I am working mainly from memory.
 
Gentlemen,

i'm afraid the suggested code won't work; using the same identifier name for a group field and it's subordinate is asking for trouble. For example, that last MOVE to IBC-PAT-NO won't be resolved by a decent compiler, and it's impossible to define which one you want to adress.

Besides this, i think the redefinition is superfluous, as is the extra move to PAT-NO-HLDR.

Gbtech,

As Slade sugggested already, it looks like you want to truncate the original field, but from your example it's not clear how, and what. Could you supply some more detail on that matter ?

Good luck !
 
You're right Ron, I didn't notice the dupe name. GB, just rename the 05 to IBC-PAT-NO-GRP. About the redefines, Ron; I always opt away from overlapping moves, or are you suggesting ref modification?

Regard, Jack.
 
Jack,

i wasn't directly thinking about refmod; i seemed to me that first moving field contents to an extra field and then moving it onwards to the redefinition of the original doesn't make sense. A redefinition should avoid just such actions.
Then again, i can't really get a clear picture yet of what Gbtech wants to actually accomplish: "I need to move data in one field 4 spaces to the right ..." means what, dropping the rightmost 4 bytes ? Or enlarging the field by 4 bytes on the left side, containing spaces ? The pic's in the example don't tell the whole tale, either.

Ronald (Ron's fine; people often call me that).
 
Hi Ronald,

That "ald" increased my salutation effort by 50%. That's ok, a person's wishes concerning his/her name should always be respected. Mohammed Ali had that problem when people insisted on calling him Cassius Clay after his conversion.

Regards, Jack. Notice I gave you more than one this time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top