How can I determine the CCSID of a file in IFS?

346360 pts.
Tags:
CCSID
IFS
RPGLE
I have a bunch of files in IFS that have a wide variety of CCSIDs and I'm trying to create a simple RPGLE that will allow users to view all these files.

Now our system CCSID is 655335 and our jobs have a default CCSID of 37 so when I try to display different CCSIDs, I see a bunch of garbage symbols and numbers.

I know you can convert data from one CCSID to another with QtqlconvOpen API but my problem is related to finding out the CCSID of the IFS file programatically. How can I find it? Thanks.

Answer Wiki

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

There are APIs, which could be called by your RPG application, that return the CCSID of an IFS object. For the stat() API see the structure subfield st_ccsid. For the Qp0lGetAttr() API see QP0L_ATTR_CCSID. Other APIs also exist but are essentially flavors of these two. Both APIs can be found in the IBM Information Center.

As Tom suggests, the APIs will tell you what the user indicated would be stored. Not necessarily what someone really stored…
Bruce Vining

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
  • TomLiotta

    Normally you might use WRKLNK to navigate to the streamfile that you're interested in and take option 8='Display attributes'. The CCSID attribute is shown as "Coded character set ID".

    But that is the attribute that was assigned when the file is created. It's not necessarily the CCSID that the data should have. If displaying the streamfile shows only garbage, then the CCSID attribute could be wrong.

    Are you sure that the data should appear as text? How did the file get created on your system?

    Tom

    125,585 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