Joined: 02 Dec 2002 Posts: 629 Topics: 176 Location: Stockholm, Sweden
Posted: Wed Dec 14, 2011 5:15 am Post subject: Using POINTER to address variable in working-storage
I found examples of the usage of POINTER, but most of them seemed to be when one program calls another. I believe my requirement is different.
I need to fill a variable in working storage with data from a file. The "trouble" is, at the moment, I'm not sure if I need to compress (strip trailing blanks from) each field or not. The WS variable is defined as:-
The first variable is the scenario where I don't need to compress the data, the second one is a variation where I will be compressing. I would like to make my code as flexible as possible, so I've coded it as follows so far (this obviously isn't correct/finished yet
Code:
05 aa-field pic x(50).
05 aa-addr pointer.
.
.
.
.
* fordeln-in-ARIDFR-GRP is the next input file field
move fordeln-in-ARIDFR-GRP to aa-field
set aa-addr to address of kontonummer
perform q-leading-chars
.
.
.
*****************************************************************
*
*****************************************************************
q-leading-chars section.
if vx-compress-data-ja
move 0 to ix-1
inspect function reverse(aa-field)
tallying ix-1 for leading ' '
compute ix-leading = length of aa-field
- ix-1
* All blank ????
if ix-leading not = 0
* No - at least one character in aa-field - move across
* to compressed field
move aa-field(1:ix-leading)
to fordeln-detaljer-compress(ix-pos:ix-leading)
add ix-leading to ix-pos
end-if
* Move the separator to position after data
move kk-sep to fordeln-detaljer-compress(ix-pos:1)
add 1 to ix-pos
else
* This next line isn't working, but basically, I'm trying to move
* the content of aa-field to (in this example) kontonummer
[color=red] move aa-field to aa-addr[/color]
move kk-sep to kd-kontonummer-sep
end-if
exit.
Is there some way of achieving what I want to do ?.
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
Posted: Wed Dec 14, 2011 6:03 am Post subject:
misi01,
not really sure what you are trying to do.
why not UNSTRING and then STRING?
show us the input data layout,
the desired output data layout
and we may be able to help.
by the way, MOVE AA-FIELD TO AA-ADDR will not achieve anything useful,
nor will it compile. _________________ Dick Brenholtz
American living in Varel, Germany
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum