infor.com
concierge
infor u
developer portal
Home
Groups
Lawson - Technology Customer Community [READ ONLY]
COBOL program - file with numeric fields that should be zeroes
unknown
I have a custom COBOL program that I have written. I have to write out numeric values to various fields for employees that may or may not contain a value. If the employee does not have a value for the specific field, the vendor wants a zero in the field. I am not getting zeroes in these fields I am getting spaces. I have defined the file in WRKDEF and the fields are defined as NUMERIC with a size of 10.2. I initialize the record in the program. I have put displays in the program and can see fields are zeroes before the file is written and after the file is written. I am not opening the file in Excel so I know they are not being stripped out when looking at the file.
What do I need to do in order for the fields to hold the zero values?
Thanks.
Find more posts tagged with
Infor Lawson Technology Group - Discussion
Comments
unknown
I've moved a special character to the field originally, and then as the last process in the Program use 'sed' to change the Special Character to spaces/zeroes - i.e.
MOVE SPACES TO WS-LS-CMD.
STRING "sed 's/^^^^/ /' " DELIMITED BY SIZE,
FTP-TARGET DELIMITED BY SPACE,
" > " DELIMITED BY SIZE,
WS-TARGET DELIMITED BY SPACE,
INTO WS-LS-CMD.
DISPLAY WS-LS-CMD.
CALL "system" USING WS-LS-CMD-S.
This moves spaces to the field, but you can easily substitute zeroes.
unknown
The issue may not be your program or file, but, Excel. You can confirm this on the server side with a file dump as that the field should contain a zero. If this is true, then Excel is masking the zero with a space. I have often found problems using Excel as a formatting tool back to Lawson. Particularly with dates and numbers.
0911060553270289.pdf
unknown
Good point Kelvin.
I ALWAYS use a Text Editor to check the file (Notepad ++), rather than Excel.
unknown
I too, have found Notepad++ as a useful tool. Not just for data review, but, also simple java / javascript adjustments. For example, EMSS and RQC.
unknown
What is the end result/value that you are looking for in the field? '0000000000' OR is it formatted and/or signed? You say that you've initialized the
record. The 'record' element is actually alpha. So the initialization command will move all spaces/blanks to the record and initialize the
numeric fields to 'null' or 40404040. What I would do in this case is directly after the Initialize record, is move ZEROES to each numeric field within the record.
This will truly initialize the numeric field to 0.
unknown
In the case that Sue has explained, it is not the tool that is being used to view the file. A numeric zero (0) is need in the actual output file. The file is pipe delimited (|) and variable record length, so the output should look as such:
XXXXX|0|0|0 - however what is actually happening is: XXXX|||. I have has this problem/issue before and it has something to do with how WORKDEF is handling the defined output file.
unknown
I just verified with Infor support. When using workdef to define an output with the Media Type as CSV the 800-WRITECSV-FileName routine is used in your COBOL program. Therefore, when moving zeroes to the csv file, the fields would actually be empty.
unknown
The best suggestion was mentioned earlier: use a script to do a search and replace of some other character. Or have the vendor change the their spec to accept a null field and interpret it as appropriate. We made healthstream change their default applications behavior to do just that.
Quick Links
All Categories
Recent Posts
Activity
Unanswered
Groups
Help
Popular Tags
Infor Lawson Human Resources Group - Discussion
Infor Lawson Technology Group - Discussion
General Discussions
VISUAL - Enterprise General Discussions
Infor Lawson Supply Chain Management - Discussion
Process Automation (IPA) - General Discussions
Pegasus - Partner General Discussions
Infor Lawson Supply Chain Group - Discussion
Infor Lawson Financials Group - Discussion
Infor EPM Discussions