View previous topic :: View next topic |
Author |
Message |
misi01 Advanced
Joined: 02 Dec 2002 Posts: 629 Topics: 176 Location: Stockholm, Sweden
|
Posted: Thu Apr 29, 2021 8:40 am Post subject: Generate CICS BUNDLE using DFHJS2LS |
|
|
Let's see if I can explain this first time through. We are using DFHJS2LS to generate a CICS bundle based on our schema. The relevant field(one of many) in the schema looks like this
Code: |
"product_type": {
"description": "KD-PRODUKTTYP - type of product",
"type": "integer",
"maximum": 9
},
|
When we run it through DFHJS2LS, the resulting generated copybook variable looks like this
Code: |
06 product-type PIC S9999 COMP-5 SYNC.
|
instead of the expected (for me)
Code: |
06 product-type PIC 9.
|
(I deliberately haven't included the S since schema variable has no minimum negative value).
I read about the option
Quote: |
MAPPING-OVERRIDES=INTEGER-AS-PIC9 |
but that didn't seem to make any difference.
I also read about integers here
https://www.ibm.com/docs/en/cics-ts/5.2?topic=mapping-json-schema-cobol
but was none the wiser for that.
Is there a simple way of ensuring fields defined as integers in the schema are generated as PIC 9(n), where n is the number of digits in the maximum value for the field? _________________ Michael |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
|
Back to top |
|
|
misi01 Advanced
Joined: 02 Dec 2002 Posts: 629 Topics: 176 Location: Stockholm, Sweden
|
Posted: Thu Apr 29, 2021 10:38 am Post subject: |
|
|
That would have been brilliant if it had worked (which it didn't, unfortunately).
Here are the parms for bundling
Quote: |
BUNDLE=/our_unix/KreDirekt-Req
CHAR-MULTIPLIER=1
MAPPING-OVERRIDES=INTEGER-AS-PIC9
CCSID=278
CHAR-VARYING=NO
DATA-TRUNCATION=DISABLED
DATETIME=STRING
INLINE-MAXOCCURS-LIMIT=32767
JSONTRANSFRM=KreDirekt-Req
JSON-SCHEMA=/our_unix/json/*
/KreDirekt-Req-schema.json
LANG=COBOL
LOGFILE=/tmp/IAT473.log
MAPPING-LEVEL=4.3
MINIMUM-RUNTIME-LEVEL=4.3
OVERWRITE-OUTPUT=YES
PDSCP=278
PDSLIB=IKKD.IKK.JSONCOPY
PDSMEM=RB520I
|
I checked in the SYSOUT for the generation, and both CHAR-MULTIPLIER and MAPPING-OVERRIDES were included there.
The results in JSONCOPY were still
Code: |
06 product-type PIC S9999 COMP-5 SYNC.
|
BTW. Just saw this in the documentation you pointed me to
Quote: |
Binary, numeric, zoned, and packed decimal fields are not subject to this multiplier.
|
which seems to preclude its use here. _________________ Michael |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Thu Apr 29, 2021 11:13 am Post subject: |
|
|
misi01,
Did you change the definition ?
Code: |
"product_type": {
"description": "KD-PRODUKTTYP - type of product",
"type": "integer",
"maximum": 9
},
|
You need to change that to be a CHARACTER format. _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
misi01 Advanced
Joined: 02 Dec 2002 Posts: 629 Topics: 176 Location: Stockholm, Sweden
|
Posted: Thu Apr 29, 2021 3:01 pm Post subject: |
|
|
No, I hadn't realised I had to do so that. When you say character format, do you mean to define it as
Code: |
"type": "string",
"maximum": 9
|
_________________ Michael |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Thu Apr 29, 2021 7:42 pm Post subject: |
|
|
misi01,
I believe you have to define it as "string". Not sure if you require maximum value as you are defining the string as just 1 byte. _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
misi01 Advanced
Joined: 02 Dec 2002 Posts: 629 Topics: 176 Location: Stockholm, Sweden
|
Posted: Thu Apr 29, 2021 11:34 pm Post subject: |
|
|
Okay, after some experimentation, I figured it out.
To achieve a generated cobol definition of PIC 9(1) (rather than PIC S9999 COMP-5 SYNC.), you have to include the "minimum" option in your schema.
Without that, it doesn't matter whether you include the
Quote: | MAPPING-OVERRIDES=INTEGER-AS-PIC9 |
or not.
Somehow, this seems illogical, but, hey, what do I know? _________________ Michael |
|
Back to top |
|
|
|
|