MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Generate CICS BUNDLE using DFHJS2LS

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
misi01
Advanced


Joined: 02 Dec 2002
Posts: 629
Topics: 176
Location: Stockholm, Sweden

PostPosted: Thu Apr 29, 2021 8:40 am    Post subject: Generate CICS BUNDLE using DFHJS2LS Reply with quote

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
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Thu Apr 29, 2021 9:23 am    Post subject: Reply with quote

misi01,

If your intention is to produce a single byte numeric field, you need to use CHAR-MULTIPLIER=1 rather than defining it as integer. With Char definition you can then have MAPPING-OVERRIDES=INTEGER-AS-PIC9 which would generate 1 byte numeric value.

Check this link

https://www.ibm.com/docs/en/cics-ts/5.2?topic=cja-dfhjs2ls-json-schema-high-level-language-conversion-linkable-interface
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
misi01
Advanced


Joined: 02 Dec 2002
Posts: 629
Topics: 176
Location: Stockholm, Sweden

PostPosted: Thu Apr 29, 2021 10:38 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Thu Apr 29, 2021 11:13 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
misi01
Advanced


Joined: 02 Dec 2002
Posts: 629
Topics: 176
Location: Stockholm, Sweden

PostPosted: Thu Apr 29, 2021 3:01 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Thu Apr 29, 2021 7:42 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
misi01
Advanced


Joined: 02 Dec 2002
Posts: 629
Topics: 176
Location: Stockholm, Sweden

PostPosted: Thu Apr 29, 2021 11:34 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group