MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Using POINTER to address variable in working-storage

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
misi01
Advanced


Joined: 02 Dec 2002
Posts: 629
Topics: 176
Location: Stockholm, Sweden

PostPosted: Wed Dec 14, 2011 5:15 am    Post subject: Using POINTER to address variable in working-storage Reply with quote

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:-
Code:

      *
       01  fordeln-detaljer.
           05  kontonummer             pic x(50).
           05  kd-kontonummer-sep      pic x.
           05  kundnummer              pic x(50).
           05  kd-kundnummer-sep       pic x.
           05  kundensandel            pic x(6).
      *
       01  fordeln-detaljer-compress   pic x(108).

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 ?.
Back to top
View user's profile Send private message Send e-mail
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Wed Dec 14, 2011 6:03 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
misi01
Advanced


Joined: 02 Dec 2002
Posts: 629
Topics: 176
Location: Stockholm, Sweden

PostPosted: Wed Dec 14, 2011 7:17 am    Post subject: Dick Reply with quote

Quote:
by the way, MOVE AA-FIELD TO AA-ADDR will not achieve anything useful, nor will it compile.

That's why the code contained the comment
Quote:
* This next line isn't working, ......


Basically, I'm trying to move a number of input fields to an output record. Assume that
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group