passing values from a csv file to db

Posted by hermes on 23-May-2016 09:34

I have tried several ways to do this but can I have some help passing variables? I have a chicken or the egg scenario.

I am  reading in a file and exporting data to the database

So I have a global variable vOrder

This value should be stored in a head temp table but the value in the csv  is from an order temp table that happens after the head temp table is populated

... RUN theHead.

....RUN theorder.

====

/* First I am defining a global variable */

DEF VAR vOrder AS INT NO-UNDO.
====

/* The code runs in this order */

    CASE sv_element[1]:
      WHEN "Head" THEN
       DO:
         RUN theHead.         
       END.
      WHEN "Order" THEN
       DO:
         RUN theOrder.
         MESSAGE "|" vOrder "|" VIEW-AS ALERT-BOX.
       END.


=====

/* this is in theOrder */


CREATE tt_order.
ASSIGN vOrder                            = INT(sv_element[03])   /* get  the  value in this spot of csv */
.

CREATE tt_head.
  ASSIGN tt_856head.po = STRING(vorder).


======

  /* out to db */
    ASSIGN  tt_head.order = STRING(vorder).
 
    CREATE out_order.
      ASSIGN
      out_order.order             = tt_head.order
      out_order.vendor         = gvendor  
      out_order.company        = gcompany
      .

Thanks for any help

All Replies

This thread is closed