Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Declare simple types for all the COBOL PIC types #3

Open
mbeckerle opened this issue Dec 30, 2022 · 0 comments
Open

Declare simple types for all the COBOL PIC types #3

mbeckerle opened this issue Dec 30, 2022 · 0 comments

Comments

@mbeckerle
Copy link
Member

    @mbeckerle Consider declaring simple types for all the COBOL PIC types. You can carry some properties on the simple types to avoid duplication. It also makes sense to a someone familiar with COBOL. Example:
	<xsd:simpleType name="PIC9-Comp3__short" dfdl:representation="binary"
		dfdl:binaryNumberRep="packed">
		<xsd:restriction base="xsd:unsignedShort">
			<xsd:minInclusive value="0" />
			<xsd:maxInclusive value="9999" />
		</xsd:restriction>
	</xsd:simpleType>

I can see if IBM can donate the full list of simple types.

Originally posted by @smhdfdl in #1 (comment)

@mbeckerle mbeckerle changed the title @mbeckerle Consider declaring simple types for all the COBOL PIC types. You can carry some properties on the simple types to avoid duplication. It also makes sense to a someone familiar with COBOL. Example: Declare simple types for all the COBOL PIC types Dec 30, 2022
mbeckerle added a commit to mbeckerle/Cobol that referenced this issue Jan 21, 2024
The COBOL says SIGN LEADING On the TOTAL-CHARGES field.
It was using default trailing sign. Changed this and the test data.
This was not only leading/trailing inverted, but it had
'y' as the expected sign character, which is the asciiStandard convention
for -9 digit. This schema and test data is ebcdic however,
so that character should be 'R'.

That lead to discovery of DAFFODIL-2873 - that zoned
ebcdic overpunched signs do not work.

Hence, this example now requires daffodil version 3.7.0 or higher,
(or a 3.7.0-SNAPSHOT build with the fix for DAFFODIL-2873 which was commited
on 2024-01-21)

Added example of using xs:date instead of treating date as strings.
COBOL has no date data type, but it is natural to want to use DFDL
date/time types so the parsed output XML/JSON/Other creates a date type.

Added comments about the COBOL types and PIC clauses as guidance for
COBOL users who encounter such combinations and to assist with Issue DFDLSchemas#3
(DFDLSchemas#3).

Test is two-pass round trip since F9 is canonicalized to C9
when unparsing. Retained this in the test data just to verify
that this canonicalization on unparsing is happening.

Update sbt to latest.

Update Daffodil to 3.7.0-SNAPSHOT as this is required for the fix to
DAFFODIL-2873 (fixes zoned ebcdic overpunched signs).

DFDLSchemas#7
mbeckerle added a commit that referenced this issue Jan 22, 2024
The COBOL says SIGN LEADING On the TOTAL-CHARGES field.
It was using default trailing sign. Changed this and the test data.
This was not only leading/trailing inverted, but it had
'y' as the expected sign character, which is the asciiStandard convention
for -9 digit. This schema and test data is ebcdic however,
so that character should be 'R'.

That lead to discovery of DAFFODIL-2873 - that zoned
ebcdic overpunched signs do not work.

Hence, this example now requires daffodil version 3.7.0 or higher,
(or a 3.7.0-SNAPSHOT build with the fix for DAFFODIL-2873 which was commited
on 2024-01-21)

Added example of using xs:date instead of treating date as strings.
COBOL has no date data type, but it is natural to want to use DFDL
date/time types so the parsed output XML/JSON/Other creates a date type.

Added comments about the COBOL types and PIC clauses as guidance for
COBOL users who encounter such combinations and to assist with Issue #3
(#3).

Test is two-pass round trip since F9 is canonicalized to C9
when unparsing. Retained this in the test data just to verify
that this canonicalization on unparsing is happening.

Update sbt to latest.

Update Daffodil to 3.7.0-SNAPSHOT as this is required for the fix to
DAFFODIL-2873 (fixes zoned ebcdic overpunched signs).

#7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant