Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...It's extraordinarily refreshing to see truly expert advice without having to wade through hipper than thou attitude..."

Geography

Where in the world do Tek-Tips members come from?
Varmit57 (IS/IT--Management)
25 Sep 07 18:22
I'm just starting out in Progress and have been handed job that that I'm not having much luck with.

I have a .CSV file with Vendor Numbers and Days in them that need to be updated in our system.

The .CSV file that is formated like:

123456,T
234567,F

it has about 600 records like that.


I need to have it find the Vendor# and change the day on each record to match what is in the .CSV file.

Can someone give me some code to get me started?

Everything that I have tried is erroring out.

Thanks for any help.
 
HelloMike (MIS)
26 Sep 07 10:20
Make sure your csv file has a carriage return after the last line of data. Then fiddle with this (untested) code snippet below.

CODE

DEFINE VARIABLE cText AS CHARACTER NO-UNDO.
DEFINE VARIABLE iCount AS INTEGER NO-UNDO.
DEFINE VARIABLE iVendor AS INTEGER NO-UNDO.
DEFINE VARIABLE cDay AS CHARACTER NO-UNDO.

INPUT FROM myFileName NO-ECHO.

REPEAT:
    IMPORT UNFORMATTED cText.

    DO iCount = 1 TO NUM-ENTRIES(cText,','):
        ASSIGN iVendor = INTEGER(ENTRY(1,cText,',')) NO-ERROR.
        ASSIGN cDay = ENTRY(2,cText,',').

        /* Do more stuff as required */
    END.
END.

INPUT CLOSE.
That should get you started.

Cheers, Mike.

MadMichael (Programmer)
26 Sep 07 16:32
Here's another approach:

CODE

define temp-table t-vendor
     field t-ven-num as character
     field t-day as character.

input from YourFileName no-echo.
repeat:
   create t-vendor.
   import delimiter ","
       t-vendor.t-ven-num
       t-vendor.t-day.
end.
input close.

for each t-vendor:
     /*  if your vendor.ven-num is not a character field,
         adjust as necessary */
    find vendor where vendor.ven-num = t-vendor.t-ven-num
       no-error.
    if available vendor then do:
           vendor.day = t-vendor.t-day.
    end.
    else do:
         /* this displays a message for each vendor not
            found */
         message "VENDOR NOT FOUND " t-vendor.t-ven-num
         view-as alert-box.
    end.
end.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close