I can create streamfiles with different encodings in the IFS using python
using the encoding parameter and this works fine e.g:
f = open('asci.txt', 'w', encoding='cp819')
This is good. And fine too. Some might say dandy.
However if I look at the attributes of the stream file it is always CCSID
819 if I am creating a new file.
This means that using DSPF to look at the data on the IBMi will display the
data incorrectly if that data is not actually written with encoding 819.
I can modify the file manually using EDTF to change the file's CCSID and
then it will be displayed correctly ( within the limitations of the 5250
Client ) however I assume there is a way to set this attribute correctly
for new files using python?
I understand that the IBMi is fairly unique in that it has additional
attributes on stream files that store information such as the (intended)
ccsid but I know it is possible to set these correctly when using the unix
open API to create stream files ( for example )
Additionally I'm using an IBMi in the UK and QCCSID is set to 285, I get an
error in the above code if I specify encoding='cp285' although it is quite
happy to use encoding='cp037'.
Not that I have a requirement to encoding in the IFS in 285 but I was a
little surprised that 37 was supported but not 285 - especially given that
it is a UK not US box.
However my main question is - should I be using a different method to
create my streamfiles if I want the endcoding of the streamfile ( the file
header, not the actual data ) to be other than 819?
I've tried using the codecs.open method but that seems to work the same -
it creates the data correctly but the CCSID for the file itself is always
819 for NEW files.
This mailing list archive is Copyright 1997-2026 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.