home *** CD-ROM | disk | FTP | other *** search
/ Netware Super Library / Netware Super Library.iso / file_mgt / parse_m / exampl04.pom < prev    next >
Encoding:
Text File  |  1995-05-02  |  4.7 KB  |  110 lines

  1. ;   The following comment lines are for quick-reference.
  2. ;   You can copy them into your own POM files to make programming easier.
  3. ;
  4. ;   In the table below:
  5. ;
  6. ;   "var"   means a variable that is being set.
  7. ;   "c"     means a comparator (if omitted, defaults to "equals")
  8. ;   "value" means a variable whose value is being read.
  9. ;   Square brackets [like this] indicate optional items.
  10. ;
  11. ;   -------------------------------------------  ------------------------------
  12. ;   COMMAND FORMATS                              EXAMPLE
  13. ;   ===========================================  ==============================
  14. ;   ACCEPT   value c value                       ACCEPT   $FLINE[1 3] = "YES"
  15. ;   APPEND   var value value [value [value]]     APPEND   name first last
  16. ;   BEGIN    value c value                       BEGIN    linecntr < "3"
  17. ;   CHANGE   var value value                     CHANGE   date "/" "-"
  18. ;   CHOP     from to [,from to] [...]            CHOP     1 250, 251 300
  19. ;   DONE                                         DONE
  20. ;   ELSE                                         ELSE
  21. ;   END                                          END
  22. ;   IF       value c value var value [value]     IF       x = "Y" THEN z = "N"
  23. ;   IGNORE   value c value                       IGNORE   price = "0.00"
  24. ;   INSERT   var spec value                      INSERT   price "L" "$"
  25. ;   LOOKCOLS value value value value             LOOKCOLS "1" "3" "8" "255"
  26. ;   LOOKFILE value                               LOOKFILE "C:\TABLES\DATA.TBL"
  27. ;   LOOKSPEC value value value                   LOOKSPEC "Y" "N" "N"
  28. ;   LOOKUP   var value                           LOOKUP   phonenum "FRED JONES"
  29. ;   MINLEN   value                               MINLEN   "15"
  30. ;   OUT      [value c value] |output-picture     OUT      z = "X" |{price}
  31. ;   OUTEND   [value c value] |output-picture     OUTEND   z = "X" |{$FLINE}
  32. ;   OUTHDG   value                               OUTHDG   "LIST OF EMPLOYEES"
  33. ;   PAD      var spec character len              PAD      sernum "L" "0" "10"
  34. ;   PAGELEN  value [value]                       PAGELEN  "66" "N"
  35. ;   PARSE    var value from to [control]         PARSE    x $FLINE "2*(" "3*)"
  36. ;   PROPER   var [methods [exceptions-file]]     PROPER   custname "I" "XY.PEF"
  37. ;   READNEXT                                     READNEXT
  38. ;   SET      var value                           SET      name $FLINE[20 26]
  39. ;   SETLEN   var value                           SETLEN   length custname
  40. ;   SPLIT    from to [,from to] [...]            SPLIT    1 250, 251 300
  41. ;   TRACE    var                                 TRACE    price
  42. ;   TRIM     var spec character                  TRIM     price "R" "$"
  43. ;   -------------------------------------------  ------------------------------
  44. ;
  45. ;
  46. ;   DEFAULT VALUES
  47. ;
  48. ;   LOOKCOLS:  Keyfield Start = 1, End = 10; Datafield Start = 12, End = 255
  49. ;   LOOKFILE:  No default, but you can set the file name via the /L parameter
  50. ;   LOOKSPEC:  Trim = Yes; Sorted = No; Case-sensitive = No
  51. ;   MINLEN:    1
  52. ;   PAGELEN:   0
  53. ;   PROPER:    Methods:  "IW"
  54. ;
  55. ;   ---------------------------------------------------------------------------
  56. ;
  57. ;
  58. ;   PADDING FOR CLARITY
  59. ;
  60. ;   Before:   IF PRICE "0.00" BONUS "1.00" "0.00
  61. ;   After:    IF PRICE = "0.00" THEN BONUS = "1.00" ELSE "0.00
  62. ;
  63. ;
  64. ;******************************************************************************
  65. ;
  66. ;   Restrict the lines we'll accept
  67. ;
  68. ACCEPT   $FLINE[58 60] = "IBM"
  69. ACCEPT   $FLINE[58 60] = "MAC"
  70. ;
  71. ;   Pad out description, with spaces, to 40 characters
  72. ;   We'll also modify the string -PC to read -IBMPC
  73. ;   Note the trailing space after PC to ensure it's at the end of the string
  74. ;
  75. SET      descrip       = $FLINE[19 49]
  76. INSERT   descrip         "@PC "  "IBM"
  77. PAD      descrip         "R"   " "   "40"
  78. ;
  79. ;   Make quantity only 2 characters wide (maximum would therefore be 99)
  80. ;
  81. SET      qty           = $FLINE[63 66]
  82. TRIM     qty             "A"   " "
  83. PAD      qty             "L"   " "  "2"
  84. ;
  85. ;   Take only the last three digits of the invoice number
  86. ;
  87. SET      inv           = $FLINE[14 16]
  88. ;
  89. ;   Detect minus sign and set price accordingly
  90. ;
  91. SET      price         = $FLINE[70 76]
  92. TRIM     price           "A" " "
  93. IF       $FLINE[77]    = "-" THEN minus = "-" ELSE ""
  94. INSERT   price           "L" minus
  95. PAD      price           "L" " " "7"
  96. INSERT   price           "L" "$"
  97. ;
  98. ;   Set other fields; note use of uppercase version of $FLINE ($FLUPC) for type
  99. ;
  100. SET      itemnum       = $FLINE[01 07]
  101. SET      type          = $FLUPC[51 55]
  102. SET      cat           = $FLINE[58 60]
  103. ;
  104. ;   Set output as follows:
  105. ;   Invoice, Item, Type (in uppercase), Category
  106. ;   Description, Quantity, Unit price
  107. ;
  108. OUT      |{inv} {itemnum} {type} {cat}
  109. OUTEND   | {descrip} {qty}    {price}
  110.