Hi.
I've been tinkering with my old EDI parser and I would like to extend it
with a new feature.
NB. =========================================================
NB. AS400 File Maps
NB. Each mapping follows the following format
NB. Source*Variable*Type*Length*Decimal*Justify*Default*Remarks
NB.
NB. Valid values for each values are:
NB. Source - values corresponds to names defined in RECIEVING.IJS:
NB. ENVELOP
NB. PO_HEADER
NB. PO_LINE_ITEM
NB. DESTINATION_QUANTITY
NB. SUB_LINE_ITEM
NB. LOCAL - a local map specifiying non EDI retrievable values
NB. Variable - Names defined in RECIEIVING.IJS for each Source
NB. Type - Supported datatypes: CHR, NUM, DTE
NB. note that for DATE the format will be YYYYMMDD
NB. and for NUM there will be NO decimal/period character
NB. Length - number of characters the entry will occupy
NB. Decimal - valid only for numbers, this list the decimal positions
NB. Justify - Justification, valid values are: LJ and RJ
NB. Default - if the variable value is blank, use this value
NB. Remarks - free text, NOT USED by code
NB. Additional Operation - ADVANCED, additional operation to apply to
variable
NB. =========================================================
NB.*PO_HEADER_MAP (n) definition for PO Header
PO_HEADER_MAP=: unbox '*' cutstring each cutopen noun define
LOCAL*SOURCE*CHR*8*0*LJ*POLO*Source Code*
ENVELOP*SENDER_QUAL*CHR*2*0*LJ**IQ*
ENVELOP*SENDER_ID*CHR*15*0*LJ**ID*
PO_HEADER*PO_NO*CHR*30*0*LJ**PO NO*
PO_HEADER*RELEASE_NO*NUM*3*0*RJ*000*PO REV*
LOCAL*EDI_REVISION*NUM*3*0*RJ*000*EDI REV*
PO_HEADER*PO_EXTRACT_DATE*DTE*8*0*LJ**PO Date*
PO_HEADER*CUST_ORDER_NO*CHR*30*0*LJ**Contract No*
LOCAL*LOT_NO*CHR*5*0*LJ**LOT No*
)
What I want to do is add the "Additional Operation" at the end. For
example: in the entry
LOCAL*LOT_NO*CHR*5*0*LJ**LOT No*
I want to change it to:
LOCAL*LOT_NO*CHR*5*0*LJ**LOT No*{.
So the idea is that I would only take the first item in the data so to
simulate:
cmd=. '{.'
(cmd)~ i. 10
|ill-formed name
| (cmd)~i.10
(".(cmd)) 1 2 3
|syntax error
| (".(cmd))1 2 3
What I did find out is that I can get away with it if I use the
primitives:
LOCAL*LOT_NO*CHR*5*0*LJ**LOT No*take
cmd=. 'take'
(cmd)~ 1 2 3
1
Am I missing something or I really just have to use the primitives?
Thanks.
r/Alex
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm