Results 1 to 6 of 6

Thread: %Subst and *IN

  1. #1
    Experienced Forum Member
    Join Date
    Apr 2013
    Location
    Atlanta, GA
    Posts
    101
    Rep Power
    211

    %Subst and *IN

    Whenever i want to check to see if all indicators between IN31 and IN39 are off and I use If %Subst(*IN:31:9) = *ZEROS I get errors like:

    Array has too many omitted indexes; specification is
    ignored.

    Is there a way to do this with %subst. The obvious way is If *IN31 = *OFF and *IN32 = *OFF and *IN33 = *OFF.......... but that can get tedious if there are a lot of indicators. Would like to use %subst if possible

  2. # 666
    Circuit advertisement
    Join Date
    Aug 1965
    Location
    Yakutsk, Russia
    Posts
    1,000,000
     

  3. #2
    Analyst GLS400's Avatar
    Join Date
    May 2006
    Location
    connecticut
    Posts
    1,900
    Rep Power
    5796

    Re: %Subst and *IN

    Hi Gregwa50:

    Try this:
    if %SubArr(*IN: 31: 9) = *Off;
    see here:
    http://www.code400.com/forum/showthr...ghlight=subarr

    Best of Luck
    GLS
    The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln

  4. #3
    Experienced Forum Member
    Join Date
    Apr 2013
    Location
    Atlanta, GA
    Posts
    101
    Rep Power
    211

    Re: %Subst and *IN

    Try this:
    if %SubArr(*IN: 31: 9) = *Off
    produces the following error:
    Array has too many omitted indexes; specification is
    ignored.

  5. #4
    Experienced Forum Member
    Join Date
    Sep 2012
    Location
    Milwaukee, WI
    Posts
    693
    Rep Power
    1731

    Re: %Subst and *IN

    Not sure why %SUBARR doesn't work here. (Barbara might know.)

    But you could do it like this:
    Code:
    D p_Indic         s               *   inz(%addr(*IN))  
    D Indic           ds                  based(p_Indic)   
    D                                     qualified        
    D   range31to39                  9a   overlay(Indic:31)
                                                           
     /free                                                 
        if Indic.Range31to39 = *Off;   // or *ZEROS
          .
          .
    Personally, though, I think the best fix is to eliminate the use of so many indicators! The only place I ever use numbered indicators (at all) is when communicating with display files -- if that's what you're doing, it might be better to use INDDS instead.

  6. #5
    Experienced Forum Member
    Join Date
    Oct 2012
    Location
    Toronto Canada
    Posts
    116
    Rep Power
    434

    Re: %Subst and *IN

    %SUBARR returns an array, and you can't compare an array.

    You could use %lookup:

    Code:
       if %lookup('1' : *in : 31 : 9) = 0;
          // there are no '1's in that range

  7. #6
    Experienced Forum Member
    Join Date
    Sep 2012
    Location
    Milwaukee, WI
    Posts
    693
    Rep Power
    1731

    Re: %Subst and *IN

    I like the DS approach better :-)

  8. # 666
    Circuit advertisement
    Join Date
    Aug 1965
    Location
    Yakutsk, Russia
    Posts
    1,000,000
     

Facebook Comments


Similar Threads

  1. subst/concat date elements
    By jason.aleski in forum RPG/RPGLE
    Replies: 3
    Last Post: December 27th, 2012, 09:11 PM
  2. Limitation of %Subst
    By K400 in forum RPG/RPGLE
    Replies: 3
    Last Post: July 15th, 2009, 12:10 AM
  3. %Trim, %SUBST ???
    By bryce4president in forum RPG/RPGLE
    Replies: 5
    Last Post: July 16th, 2007, 07:06 AM
  4. regarding %scan and %subst
    By kmkmagesh in forum RPG/RPGLE
    Replies: 4
    Last Post: April 6th, 2006, 03:30 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •