Converting Arrays to Scalar Data

At present, only the 'CNV TEXT' stmt addresses an Alpha array as if it were a single scalar variable. (Unfortunately, it also adjusts for periods, insuring no more than one space after a period.)

       *         initialize an Alpha Array:
       *
       SET      --- TEMP 1                     =
       CNV TEXT OPT WORK TEST ARRAY        000 =  --- TEMP 1

You can also accomplish the "Array to Scalar" assignment, by setting up a Working Storage type file, with a GROUP construction like the following:

100     WS GROUP1              GROUP HEADER   1
200     WS A50                 ALPHA          1   X(50)
300     WS GROUP1 END          GROUP TRAILER  1
400     WS GROUP2              GROUP HEADER   1
500     WS A1 50               ALPHA          1   X(1) Oc 50
600     WS GROUP2 END          GROUP TRAILER  1

... then perform the assignment as follows:

      SET      PAT WS A50                     =      XYZ
      SET      PAT WS GROUP2                  =  PAT WS GROUP1

... resulting in:

Appl Field Name             Occ  Field Value
PAT  WS A1 50               001  X
PAT  WS A1 50               002  Y
PAT  WS A1 50               003  Z


Don't forget the ability to search for individual characters (ex: commas or quotes) in ILF code, by means of the IF INCLUDES ('IF' verb with 'IN' operator) or Regular Expresssions ('IF' verb with 'RS' or 'RI' operator).

Comments:

Read what other users have said about this page or add your own comments.




This topic: Main > WebHome > DeveloperTips > ConvertingArraysToScalarData
Topic revision: r2 - 2016-02-17 - JeanNeron
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback