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 

Long values in 88-level variable

 
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: 616
Topics: 171
Location: Stockholm, Sweden

PostPosted: Wed Jan 18, 2017 2:58 am    Post subject: Long values in 88-level variable Reply with quote

I realize there are workarounds for this, but I'm just wondering if there's a variation on the code below that would work. Here's what I'm trying to do
Code:

           05  aa-fri-text             pic x(60).
               88  aa-fri-text-a1      value
                   'IPS - Kommande utbetalningsperiod'.
               88  kk-fri-text-a2      value
      *            10  filler          pic x(27)    value
                                       'IPS - Likvida medel saknasA'
      *            10  filler          pic x(13)    value
                                       'for kommandeB'
      *            10  filler          pic x(20)    value
                                       'utbetalningsperiodC'.


Basically, I hate and refuse to use continuation characters when coding Cobol. There's too much hassle if you need to add/delete characters with all the ensuing shifting of data up and down in the continuation lines. in the example above, I could define kk-fri-text2 as an ordinary variable and instead of a SET kk-fri-text2 to true, I could MOVE the variable to aa-fri-text; that's fine.

The commented lines were my first attempt. The code as-is was interesting inasmuch as it compiled fine, but when I tried doing a SET kk-fri-text2 to true,
after that, aa-fri-text only contained "IPS - Likvida medel saknasA".

Is there a way to do what I'm attempting ?
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12357
Topics: 75
Location: San Jose

PostPosted: Wed Jan 18, 2017 12:16 pm    Post subject: Reply with quote

misi01,

88 level variables are used to check multiple values or range of values. If your intention is to have as 1 value with multiple text values then what is stopping you from defining it as follows?

Code:

         WORKING-STORAGE SECTION.                                       
         01  AA-FRI-TEXT             PIC X(60).                         
             88  AA-FRI-TEXT-A1      VALUE                               
                  'IPS - KOMMANDE UTBETALNINGSPERIOD'.                   
 ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
             88  KK-FRI-TEXT-A2      VALUE                               
        'IPS - LIKVIDA MEDEL SAKNASAFOR KOMMANDEBUTBETALNINGSPERIODC'.   


At max you would get a compiler WARNING message that
Code:

An alphanumeric literal should not begin in area "A".  It was processed as if found in area "B".



and in procedure division
Code:

SET KK-FRI-TEXT-A2 TO TRUE     
DISPLAY AA-FRI-TEXT             


it would have

Code:

IPS - LIKVIDA MEDEL SAKNASAFOR KOMMANDEBUTBETALNINGSPERIODC

_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
William Collins
Supermod


Joined: 03 Jun 2012
Posts: 437
Topics: 0

PostPosted: Wed Jan 18, 2017 1:29 pm    Post subject: Reply with quote

The 2014 COBOL Standard has a "concatenation operator" (&) which would give you what you want, but it does require explicit trailing spaces to make the correct lengths when a piece of text is shorter than the space allowed for it. Maybe a Request For Enhancement?

I'm not sure I've exactly understood:

Code:
           05  aa-fri-text.
               88  aa-fri-text-a1      value
                   'IPS - Kommande utbetalningsperiod'.
                  10  filler          pic x(27).
               88  kk-fri-text-a2a      value
                                       'IPS - Likvida medel saknasA'.
                  10  filler          pic x(13).
               88  kk-fri-text-a2b      value
                                       'for kommandeB'
                  10  filler          pic x(20).
               88  kk-fri-text-a2c      value
                                       'utbetalningsperiodC'.


This would require the 88's to be all three (new ones) used at once, with three SET statements if you want to get that value in the field.

You could use two other definitions, each of 60, and with an initial combination of SET and MOVE use those fields to test against the original 60 bytes.

Without a "concatenator" (which only the compiler is interested in, I think) there's got to be some concession.
Back to top
View user's profile Send private message
misi01
Advanced


Joined: 02 Dec 2002
Posts: 616
Topics: 171
Location: Stockholm, Sweden

PostPosted: Thu Jan 19, 2017 6:23 am    Post subject: Reply with quote

Thanks both of you for your suggestions. Basically, I was looking for a simpler, "cleaner" solution than either of you suggested.

Ho-hum, will have to go with something along these lines
Code:

evaluate true
  when condition-1     
      set aa-fri-text-a1 to true  * Short value all on one line
  when condition-2
      move ' '                    to aa-fri-text
      string
         'My first part of the long string %'
         'my second part of that string %' 
         'and the remainder%'
                               delimited by '%'
         into aa-fri-text
      end-string
   when other-coditions
       set other-88-level-variables to true
end-evaluate

_________________
Michael
Back to top
View user's profile Send private message Send e-mail
William Collins
Supermod


Joined: 03 Jun 2012
Posts: 437
Topics: 0

PostPosted: Thu Jan 19, 2017 12:50 pm    Post subject: Reply with quote

As long as you have that one trailing space, or use the figurative constant SPACE, you don't need the delimiter (you chose %) but can use DELIMITED BY SIZE.
Back to top
View user's profile Send private message
misi01
Advanced


Joined: 02 Dec 2002
Posts: 616
Topics: 171
Location: Stockholm, Sweden

PostPosted: Fri Jan 20, 2017 5:46 am    Post subject: Reply with quote

Quite right William - must have had some sort of brain freeze. Of course I can throw out the % characters and used DELIMITED BY SIZE as you state.
_________________
Michael
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