PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 06/03/2016 1:12 PM by  David@SOM
0 instead of blanks in CSV file
 6 Replies
Sort:
You are not authorized to post a reply.
Author Messages
pgallucci12
Sr Application Analyst
UPHS
Basic Member
(10 points)
Basic Member
Posts:4


Send Message:

--
04/13/2016 3:26 PM
    When a 4GL program creates a CSV file, and numeric fields defined in that CSV contain ZERO values, BLANKS are substituted. Is there a way to force a ZERO instead? Is there a setting in a configuration file that can do that?

    Example: CSV file contains 2 fields, NAME and COUNT.
    The value in NAME = "J.Jones"
    The value in COUNT = 0
    Currently the CSV record for the above looks like...
    "J.Jones",
    I need it to look like...
    "J.Jones",0
    SueS
    Private
    Private
    Basic Member
    (43 points)
    Basic Member
    Posts:19


    Send Message:

    --
    04/14/2016 6:47 AM

    Hi,

     

    I just went through the same thing a few weeks ago.  Used WRKDEF to define a CSV file. Fields were defined as numeric. Anybody that did not have a value for the particular field should have had a zero but a blank was in the field instead.  A ticket was opened with Infor. The response back was that this is correct; when moving zeroes to a csv file, the fields would be empty.

     

    It seems the only way around it is to define your file in working storage.

     

    jaherb
    Private
    Private
    Veteran Member
    (471 points)
    Veteran Member
    Posts:163


    Send Message:

    --
    04/15/2016 11:00 AM
    What I have had to do in the past is to make this field an alpha field and move zeroes to it and then it would appear. The only issue you need to worry about is that if you are using the double quoted to wrap around alpha fields, you would now have double quotes around this field as well. You could then turn off the double quotes for alpha fields, but not sure if that would work for the system it is going to.
    pgallucci12
    Sr Application Analyst
    UPHS
    Basic Member
    (10 points)
    Basic Member
    Posts:4


    Send Message:

    --
    04/18/2016 11:20 AM
    What I chose to do is to use the STRING command and construct csv records that way.  I have total control over everything that way and simply write out the entire csv record string to the record of a work file using TAPE as the media.
    David@SOM
    Programmer
    State of Michigan
    (9 points)
    Posts:3


    Send Message:

    --
    06/03/2016 9:17 AM
    I have the same challenge, the user wants the zeroes instead of a blank.  I was going to construct the file using a WS layout and then write it out as a workfile. How do you use the Cobol String in the program?   Can you provide a simple example of the String command please?  
    Ragu Raghavan
    Private
    Private
    Veteran Member
    (823 points)
    Veteran Member
    Posts:287


    Send Message:

    --
    06/03/2016 9:35 AM
    if you want the record to look like 1000,abcd,05/01/2016
    STRING "1000" "," "abcd" "," "05/01/2016" DLEIMITED BY SIZE INTO OUT-REC.
    WRITE OUT-REC.

    the file related to OUT-REC is defined as type TAPE in workdef
    David@SOM
    Programmer
    State of Michigan
    (9 points)
    Posts:3


    Send Message:

    --
    06/03/2016 1:12 PM

    Thank you! 

    You are not authorized to post a reply.