Problem putting packed fields in a ds from a json in standard in
Posted: Thu Apr 13, 2023 4:29 pm
Hello' everybody, I'm creating a POC for one of our application, working with the DIY web service provider. In our scenario we receive a JSON representing a row (or record of a table) had to write/insert into the table and call another program to work on it. A very simple scenario but i must be missing something because i can't make it work.
The data from standardin is putted right into a ds representing the db table row. It has mainly character and numeric packed fields.
This is my ds:
Then here is the json i am using for a simple test
After running in my pgm
in my debug i see
why DATELG, DATELM DATELA have not the right values? In my ctl-opt instrucions i have defined decedit('0,') may this be the problem? Can someone point me to the solution? I feel i must be missing something very stupid.
TIA everybody.
The data from standardin is putted right into a ds representing the db table row. It has mainly character and numeric packed fields.
This is my ds:
Code: Select all
dcl-ds t_socie Qualified Inz;
IDRECO paked(11:0)
STATUS char(1)
CODICE packed(6:0)
SIGLAD char(6)
DENOMI char(25)
ATTIDL char(2)
CODISC char(6)
FLAGEL char(1)
DATELG packed(2:0)
DATELM packed(2:0)
DATELA packed(4:0)
DATELB date datfmt(*ISO)
end-ds;
Code: Select all
{
"IDRECO": 0,
"STATUS": " ",
"CODICE": 960000,
"SIGLAD": "ATP",
"DENOMI": "MODEST MOUSE",
"ATTIDL": "DL",
"CODISC": "123456"
"FLAGEL": " ",
"DATELG": 28,
"DATELM": 04,
"DATELA": 2023,
"DATELB": '0001-01-01'
}
Code: Select all
data-into t_socie %DATA('*STDIN' : 'case=convert allowmissing=yes')
%PARSER('YAJLINTO');
Code: Select all
EVAL t_socie
T_SOCIE.IDRECO = 00000000000.
T_SOCIE.STATUS = ' '
T_SOCIE.CODICE = 960000.
T_SOCIE.SIGLAD = 'ATP '
T_SOCIE.DENOMI = 'MODEST MOUSE '
T_SOCIE.ATTIDL = 'DL'
T_SOCIE.CODISC = '123456'
T_SOCIE.FLAGEL = ' '
T_SOCIE.DATELG = 00.
T_SOCIE.DATELM = 00.
T_SOCIE.DATELA = 0000.
T_SOCIE.DATELB = '0001-01-01'
TIA everybody.