× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Phil:

You brought up a good point regarding multiple BIFs on a single line, I had
not considered that situation.

I think the best way to handle it would be with a prompt.  Here is a
modified version of the macro.

John

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*/
/*
*/
/*  PGM NAME      -  bif_help.lx
*/
/*  PROGRAM TITLE -  Built-in function help
*/
/*  DATE WRITTEN  -  02/01/03
*/
/*  AUTHOR        -  John Larimer
*/
/*  NARRATIVE     -  Launches help for a built-in function located on the
*/
/*                   current line.
*/
/*
*/
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*/
/*
*/
/*  MODIFIED  LOG #  PGMR  DESCRIPTION
*/
/*  --------  -----  ----  ------------------------------------------------
*/
/*  02/01/03         JKL   Original Version
*/
/*  02/03/03         JKL   Prompt when line has multiple BIFs
*/
/*  -----------------------------------------------------------------------
*/
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*/

upper = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
code = ''
stem_count = 0

'extract content'
text = translate(content)

call find_bif_subroutine

if stem_count > 0 then do
  if stem_count > 1 then do

    /* Build Prompt */
    title = "Built-In Function Help Selection"
    prompt = 'Which # BIF for help? '

    do loop_count = 1 to stem_count
      prompt = prompt loop_count || '=' bif_text.loop_count
    end

    'set lineread.title' title
    'set lineread.prompt' prompt

    'lineread 1'

    'extract lastkey'

    if lastkey = 'ESC' then return

    'extract lastline'

    if lastline = "" then return

    stem_count = substr(lastline,1,1)

  end

bif_text = bif_text.stem_count

  select
    when bif_text = '%ABS' then /* Absolute Value of Expression */
    code = 'BBABS'
    when bif_text = '%ADDR' then /*  Get Address of Variable */
    code = 'BBADDR'
    when bif_text = '%ALLOC' then  /*  Allocate Storage */
    code = 'BBALLOC'
    when bif_text = '%BITAND' then /*  Bitwise AND Operation */
    code = 'BBAND'
    when bif_text = '%BITNOT' then /*  Invert Bits */
    code = 'BBNOT'
    when bif_text = '%BITOR' then /*  Bitwise OR Operation */
    code = 'BBOR'
    when bif_text = '%BITXOR' then /*  Bitwise Exclusive-OR Operation */
    code = 'BBXOR'
    when bif_text = '%CHAR' then /*  Convert to Character Data */
    code = 'BBCHAR'
    when bif_text = '%CHECK' then /*  Check Characters */
    code = 'BBCHK'
    when bif_text = '%CHECKR' then /*  Check Reverse */
    code = 'BBCHKR'
    when bif_text = '%DATE' then /*  Convert to Date */
    code = 'BBDATE'
    when bif_text = '%DAYS' then /*  Number of Days */
    code = 'BBDAY'
    when bif_text = '%DEC' then /*  Convert to Packed Decimal Format */
    code = 'BBDEC'
    when bif_text = '%DECH' then /*  Convert to Packed Decimal Format with
Half Adjust */
    code = 'BBDECH'
    when bif_text = '%DECPOS' then /*  Get Number of Decimal Positions */
    code = 'BBDECP'
    when bif_text = '%DIFF' then /*  Difference Between Two Date, Time, or
Timestamp Values */
    code = 'BBDIF'
    when bif_text = '%DIV' then /*  Return Integer Portion of Quotient */
    code = 'BBDIV'
    when bif_text = '%EDITC' then /*  Edit Value Using an Editcode */
    code = 'BBEDITC'
    when bif_text = '%EDITFLT' then /*  Convert to Float External
Representation */
    code = 'BBEDITF'
    when bif_text = '%EDITW' then /*  Edit Value Using an Editword */
    code = 'BBEDITW'
    when bif_text = '%ELEM' then /*  Get Number of Elements */
    code = 'BBELEM'
    when bif_text = '%EOF' then /*  Return End or Beginning of File
Condition */
    code = 'BBEOF'
    when bif_text = '%EQUAL' then /*  Return Exact Match Condition */
    code = 'BBEQUAL'
    when bif_text = '%ERROR' then /*  Return Error Condition */
    code = 'BBERROR'
    when bif_text = '%FIELDS' then /*  Fields to update */
    code = 'BBFIELDS'
    when bif_text = '%FLOAT' then /*  Convert to Floating Format */
    code = 'BBFLOAT'
    when bif_text = '%FOUND' then /*  Return Found Condition */
    code = 'BBFOUND'
    when bif_text = '%GRAPH' then /*  Convert to Graphic Value */
    code = 'BBGRAPH'
    when bif_text = '%HOURS' then /*  Number of Hours */
    code = 'BBHOU'
    when bif_text = '%INT' then /*  Convert to Integer Format */
    code = 'BBINT'
    when bif_text = '%INTH' then /*  Convert to Integer Format with Half
Adjust */
    code = 'BBINTH'
    when bif_text = '%KDS' then /*  Search Arguments in Data Structure */
    code = 'BBKDS'
    when bif_text = '%LEN' then /*  Get or Set Length */
    code = 'BBLEN'
    when bif_text = '%LOOKUP' then /*  Look Up an Array Element */
    code = 'BBLOO'
    when bif_text = '%LOOKUPLT' then /*  Look Up an Array Element */
    code = 'BBLOO'
    when bif_text = '%LOOKUPLE' then /*  Look Up an Array Element */
    code = 'BBLOO'
    when bif_text = '%LOOKUPGT' then /*  Look Up an Array Element */
    code = 'BBLOO'
    when bif_text = '%LOOKUPGE' then /*  Look Up an Array Element */
    code = 'BBLOO'
    when bif_text = '%MINUTES' then /*  Number of Minutes */
    code = 'BBMIN'
    when bif_text = '%MONTHS' then /*  Number of Months */
    code = 'BBMON'
    when bif_text = '%MSECONDS' then /*  Number of Microseconds */
    code = 'BBMSEC'
    when bif_text = '%NULLIND' then /*  Query or Set Null Indicator */
    code = 'BBNULL'
    when bif_text = '%OCCUR' then /*  Set/Get Occurrence of a Data Structure
*/
    code = 'BBOCCUR'
    when bif_text = '%OPEN' then /*  Return File Open Condition */
    code = 'BBOPEN'
    when bif_text = '%PADDR' then /*  Get Procedure Address */
    code = 'BBPADDR'
    when bif_text = '%PARMS' then /*  Return Number of Parameters */
    code = 'BBPARM'
    when bif_text = '%REALLOC' then /*  Reallocate Storage */
    code = 'BBREALL'
    when bif_text = '%REM' then /*  Return Integer Remainder */
    code = 'BBREM'
    when bif_text = '%REPLACE' then /*  Replace Character String */
    code = 'BBREPL'
    when bif_text = '%SCAN' then /*  Scan for Characters */
    code = 'BBSCAN'
    when bif_text = '%SECONDS' then /*  Number of Seconds */
    code = 'BBSEC'
    when bif_text = '%SHTDN' then /*  Shut Down */
    code = 'BBSHUT'
    when bif_text = '%SIZE' then /*  Get Size in Bytes */
    code = 'BBSIZE'
    when bif_text = '%SQRT' then /*  Square Root of Expression */
    code = 'BBSQRT'
    when bif_text = '%STATUS' then /*  Return File or Program Status */
    code = 'BBSTAT'
    when bif_text = '%STR' then /*  Get or Store Null-Terminated String */
    code = 'BBSTR'
    when bif_text = '%SUBDT' then /*  Extract a Portion of a Date, Time, or
Timestamp */
    code = 'BBSUBD'
    when bif_text = '%SUBST' then /*  Get Substring */
    code = 'BBSUBS9'
    when bif_text = '%THIS' then /*  Return Class Instance for Native Method
*/
    code = 'BBTHIS'
    when bif_text = '%TIME' then /*  Convert to Time */
    code = 'BBTIME'
    when bif_text = '%TIMESTAMP' then /*  Convert to Timestamp */
    code = 'BBTMST'
    when bif_text = '%TLOOKUP' then /*  Look Up a Table Element */
    code = 'BBTLOO'
    when bif_text = '%TLOOKUPLT' then /*  Look Up a Table Element */
    code = 'BBTLOO'
    when bif_text = '%TLOOKUPLE' then /*  Look Up a Table Element */
    code = 'BBTLOO'
    when bif_text = '%TLOOKUPGT' then /*  Look Up a Table Element */
    code = 'BBTLOO'
    when bif_text = '%TLOOKUPGE' then /*  Look Up a Table Element */
    code = 'BBTLOO'
    when bif_text = '%TRIM' then /*  Trim Blanks at Edges */
    code = 'BBTRIM'
    when bif_text = '%TRIML' then /*  Trim Leading Blanks */
    code = 'BBTRIML'
    when bif_text = '%TRIMR' then /*  Trim Trailing Blanks */
    code = 'BBTRIMR'
    when bif_text = '%UCS2' then /*  Convert to UCS-2 Value */
    code = 'BBUCS2'
    when bif_text = '%UNS' then /*  Convert to Unsigned Format */
    code = 'BBUNS'
    when bif_text = '%UNSH' then /*  Convert to Unsigned Format with Half
Adjust */
    code = 'BBUNSH'
    when bif_text = '%XFOOT' then /*  Sum Array Expression Elements */
    code = 'BBXFOOT'
    when bif_text = '%XLATE' then /*  Translate */
    code = 'BBXLAT'
    when bif_text = '%YEARS' then /*  Number of Years */
    code = 'BBYEAR'
  otherwise
  NOP
  end /* select */
end

if code <> '' then 'code { 3 EVFRILSH.IDM' code
else 'ILEPAR HELP'

exit /* end program */


find_bif_subroutine:
do forever
  bif_start = pos('%',text)
  if bif_start = 0 | stem_count > 9 then leave

  else do
    stem_count = stem_count + 1
    bif_text = substr(text,bif_start)
    bif_end = verify(bif_text,upper,,2)
    bif_text.stem_count = substr(bif_text,1,(bif_end - 1))
    text = substr(text,(bif_end + bif_start - 1))
  end
end
return


<sublime78ska=K2GnTyEPumIAvxtiuMwx3w@public.gmane.org> wrote in message
200302031754.h13Hsjon007520@linux.midrange.com">news:200302031754.h13Hsjon007520@linux.midrange.com...
> John,
>
> This is great!  This has always been a pia.
>
> Found a problem, though, if the first thing you press F1 on is like this:
>
> C        if     %eof
>
> so I added this:
>
>   if bif_end < 1 then do
>      bif_end = pos(' ',bif_text)
>   end
>   else
>
> between verify and the substr after the verify.
>
> Then I wanted to be able to press F1 on this:
>
> C      eval      len = %len(%trim(field))
>
> and be able to get help for %trim.  I looked around for documentation on
how to
> retrieve the cursor position - and found some but could get none to work.
>
> Phil
> _______________________________________________
> This is the CODE/400 Discussion & Support (CODE400-L) mailing list
> To post a message email: CODE400-L=Zwy7GipZuJhWk0Htik3J/w@public.gmane.org
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/code400-l
> or email: CODE400-L-request=Zwy7GipZuJhWk0Htik3J/w@public.gmane.org
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/code400-l.
>
> NOTE: WDSc for iSeries disucssion has it's own mailing list.
> Information can be found at
http://lists.midrange.com/cgi-bin/listinfo/wdsc-l
>
>




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.