Hello,

(Sorry for the delay ! And thanks to all of you (John, Glenn, Rob, ...) wich made me understand what one can do with "JUXTAPOSE")

Here's the kind of solution I had in mind when I wrote my question.
Would anyone have anything simpler/shorter, that would do the same job, given the same conditions ?
- enriches a file with data from a reference
- has low memory usage (so, no LOOKUP?)
- works even if the file to enrich has "multiple keys" (so, no possible permutation between MASTER and DETAIL : no LOOKUP ?)


  /**/

  i=0
  i=i+1; keysValues.i = "1One  "
  i=i+1; keysValues.i = "2Two  "
  i=i+1; keysValues.i = "3Three"
  keysValues.0 = i

  i=0
  i=i+1; toEnrich.i = "AA1aa"
  i=i+1; toEnrich.i = "BB2bb"
  i=i+1; toEnrich.i = "CC2cc"
  i=i+1; toEnrich.i = "DD3dd"
  toEnrich.0 = i

  "pipe (endchar %)",
  "  stem keysValues.",
  "| insert /M/", /* 'M' <-> MASTER records */
  "| C: collate 2.1 4.1 MASTER DETAIL",
  ,
  , /* After the COLLATE : */
  ,
  , /* |...+.. */
  , /* M1One   */
  , /* DAA1aa  */
  , /* M2Two   */
  , /* DBB2bb  */
  , /* DCC2cc  */
  , /* M3Three */
  , /* DDD3dd  */
  ,
  "| P: pick 1.1 == /M/",
  "| J: juxtapose",
  ,
  , /* After the JUXTAPOSE : */
  ,
  , /* |...+....1... */
  , /* M1One  DAA1aa */
  , /* M2Two  DBB2bb */
  , /* M2Two  DCC2cc */
  , /* M3ThreeDDD3dd */
  ,
  "| spec ",
  "    9.2 1 ",
  "    3.5 n ",
  "   12.2 n ",
  ,
  , /* Final result : */
  ,
  , /* |...+.... */
  , /* AAOne  aa */
  , /* BBTwo  bb */
  , /* CCTwo  cc */
  , /* DDThreedd */
  ,
  "| console",
  ,
  "%",
  "  stem toEnrich.",
  "| insert /D/", /* 'D' <-> DETAIL records */
  "| C:",
  ,
  "%",
  "  P:",
  "| J:"

Thanks

Michaël

Reply via email to