× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On 06-May-2015 14:37 -0500, Jim Franz wrote:
I have a program running for years using writeline, writing an xml
file, and within 1.4 million writes, a single instance of a single
quote (ebcdic hex 7D) did not translate to ascii correctly. I've used
this process for years in writing edi files without having this
issue. This is V7R1. We send this file every day, always building a
new uniquely named file.

This worked (wrklnk display, ascii hex and) the single quote in
ascii is 27

454D504C 4F594545 275320 EMPLOYEE'S

this is ebcdic from file

C5D4D7D3 D6E8C5C5 7DE240C1 D9D440 EMPLOYEE'S ARM

from same file, same column of data

This did not and single quote is now ascii 1A (which blew the
trading partner's process..)

20534149 44205348 45204449 444E1A54 * SAID SHE DIDN T
20464545 * FEE

Expected ASCII cp00819:

20534149 44205348 45204449 444E2754 * SAID SHE DIDN'T
20464545 4C205745 * FEEL WE


this is the ebcdic where single quote is 7D

40E2C1C9 C440E2C8 C540C4C9 C4D57DE3 * SAID SHE DIDN'T
40C6C5C5 D340E6C5 * FEEL WE

text file is CCSID 819

This writes the one record (it's based on an old set of code, but it
has always worked)

eval @vdata = %trim(CLCMLN)
exsr $valid
eval @dtext=indent2+'<IncidentDesc>' +
%trim(@vdata) +
'</IncidentDesc>'
eval @len = %len(%trimr(@dtext))
callp writeline(fd: %addr(@dtext):@len)

DSPFFD of column

Field Type Length Length Position Usage Heading
CLCMLN CHAR 150 150 324 Both CAUSE xxx
Field text . . . . . . . . . . . . : CAUSE OF INJURY
Referenced information
Referenced file . . . . . . . . . : SREF
Library . . . . . . . . . . . . : MMOD
Referenced record format . . . . : CSREF
Referenced field . . . . . . . . : CMLN
Attributes changed . . . . . . . : Other
Coded Character Set Identifier . . : 37

Text File create

Create a new file, and assign it a code page of 819:
Create this file with "all" permissions *RWX per BTS requirements

eval fd = open(%trim(filename):
O_CREAT+O_WRONLY+O_CODEPAGE:
S_IRWXO+S_IRWXU+S_IRWXG:
819)
if fd< 0
callp die('open(): ' + %str(strerror(errno)))
eval @errflag='Y'
endif
callp close(fd)

Now re-open the file in text mode. Since it was assigned a
code page of 819, and we're opening it in text mode, OS/400
will automatically translate to/from ASCII for us.
eval fd = open(%trim(filename):
O_WRONLY+O_TEXTDATA)


Have I missed something obvious?


Seems that a likely origin could be that the column CLCMLN has the EBCDIC substitution character 0x3F rather than the presumed apostrophe character 0x7D for the data that was written, thus the ASCII substitution character 0x1A would be the expected result. Does the following query yield any results?:

select rrn(a), a.*
from the_file
where CLCMLN like '%' concat x'3f' concat '%'


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.