AS/400 Journaling download to PC – unreadable data

pts.
Tags:
AS/400
CPYTOIMPF
Journaling (Exchange)
unreadable
We are journaling some files on the AS/400 and need to download the journal entries to a pc based file. We are using the DSPJRN command to copy the journal entries to a db file and then using the CPYTOIMPF command to convert it to a text file. This issue is that some of the data is unreadable. We believe this has something to do with the default CCSID that is set by IBM that is not converting the data. Does anyone have any easy solutions of how to get the data in a readable format without creating an RPG program?

Answer Wiki

Thanks. We'll let you know when a new response is added.

The Journal contains the entire record image as a binary field: character type fields are ok, packed and negative signed fields and a lot of newer field types are going to remain in their binary form when you do dsp journal. Since it’s then moved to the IFS as a single field it cannot be decoded.

The journalled data needs to be restored or moved in some way on the 400 to the physical file structure that it originaled in and then it can be decoded.

It’s been a LONG time, but maybe I can get you started. I used the DSPJRN command to copy the entries to a pf as you are doing. I then looked carefully at the file using DSPPFM and found the undisplayable characters – I believe there are two bytes in the file that are in binary format. I created a query to read the file, parse out the two bytes to a shorter field, and output from the query to another pf. Then I could move the new file to my pc without any problems. Not an elegant solution, but it worked for what I needed at the time.

===============================================================

There is essentially no point to ever transfer journal entries to a PC without converting them first on the iSeries. Granted, conversion can be done on a PC as long as the full file description is available to determine how each byte should be handled and assuming that CCSID conversion from the database settings makes sense for both character and any non-character data after the conversion to a PC CCSID in the initial transfer.

The basic problem is that the journaled record image is held as a single field without any consideration for data types within the record image. (DB2 journal processes don’t need them.)

If there are only character fields and they’re all the same appropriate CCSID, then CPYTOIMPF can get the job done well enough.

If not, then the journal entries can be retrieved to an outfile that can do the work of preparing packed, zoned and binary fields for you. Create a file with a record format that joins the all of the standard journal header fields, omitting the entry-specific data field, together with the fields from the file being journaled. (A dynamic SQL SELECT statement can be constructed with a field list that contains all fields and executed with CREATE TABLE AS.)

When the DSPJRN command creates an outfile of images, you can then run CPYF from there to your new table specifying FMTOPT(*NOCHK) to do a straight copy of the record image. When the records are retrieved from the new file, all field definitions will be applied for both the journal fields and the database file fields. A CPYTOIMPF will then convert all fields, character and non-character automatically.

Tom

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Alexa
    I had used the CPYTOIMPF as follows : CPYTOIMPF FROMFILE(&FILELIB/&FILE) + TOSTMF('/QIBM/Folder/file.txt') + MBROPT(*REPLACE) STMFCODPAG(*PCASCII) + RCDDLM(*CRLF) DTAFMT(*DLM) STRDLM(*NONE) + FLDDLM('|') The Key(STMFCODPAG(*PCASCII) )
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following