ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
*... variables para verificar la configuración regional...
01 caracter pic x(255).
01 buffer pic s9(9) comp-5.
01 retcode pic s9(9) comp-5.
01 estilo pic s9(9) comp-5.
77 wsep-dec pic x.
77 wsep-mil pic x.
01 wcobranza.
02 pic x(50) value '{'.
02 pic x(50) value ' "ALUMNO": "Chiavazza Adolfo Carlos",'.
02 pic x(50) value ' "DNI": "22222222",'.
02 pic x(50) value ' "FECHA": "10-03-2022",'.
02 pic x(50) value ' "COBRANZA": ['.
02 pic x(50) value ' {'.
02 pic x(50) value ' "TIPO": 1,'.
02 pic x(50) value ' "PERIODO": "03-2022",'.
02 pic x(50) value ' "IMPORTE": 5000'.
02 pic x(50) value ' },'.
02 pic x(50) value ' {'.
02 pic x(50) value ' "TIPO": 2,'.
02 pic x(50) value ' "PERIODO": "03-2022",'.
02 pic x(50) value ' "IMPORTE": 1000.02'.
02 pic x(50) value ' }'.
02 pic x(50) value ' ]'.
02 pic x(50) value '}'.
01 jfecha pic x(10).
01 redefines jfecha.
02 jfecha-dd pic 99.
02 pic x.
02 jfecha-mm pic 99.
02 pic x.
02 jfecha-aa pic 9999.
01 wfecha pic 9(8).
01 redefines wfecha.
02 wfecha-aa pic 9999.
02 wfecha-mm pic 99.
02 wfecha-dd pic 99.
01 indA pic s9(9) comp-5 value zeros.
01 w--ii pic 9(8).
01 dato pic x(200).
01 wdatos.
02 wtipo pic 999.
02 wperiodo pic x(7).
02 wimporte pic 9(12)v99.
02 l-importe pic z(12),zz.
PROCEDURE DIVISION.
comienzo.
perform pone-punto.
invoke json "Clear".
invoke json "Load" using wcobranza.
invoke json "StringOf" using "FECHA" returning jfecha.
display jfecha.
invoke json "SizeOfArray" using "COBRANZA" returning indA.
perform varying w--ii from zeros by 1 until w--ii = indA
move spaces to dato
string "COBRANZA[" delimited by size
w--ii delimited by size
"]" delimited by size
"." delimited by size
"TIPO" delimited by size
into dato
end-string
invoke Json "StringOf" using dato returning wtipo
move spaces to dato
string "COBRANZA[" delimited by size
w--ii delimited by size
"]" delimited by size
"." delimited by size
"PERIODO" delimited by size
into dato
end-string
invoke Json "StringOf" using dato returning wperiodo
move spaces to dato
string "COBRANZA[" delimited by size
w--ii delimited by size
"]" delimited by size
"." delimited by size
"IMPORTE" delimited by size
into dato
end-string
invoke Json "StringOf" using dato returning wimporte
move wimporte to l-importe
display wtipo, " ", wperiodo, " ", l-importe
end-perform.
perform pone-coma.
exit program.
pone-coma.
*>... Seteo en Windows el separador decimal
move spaces to caracter.
move "," to caracter(1:1).
move X"00" to caracter(2:1).
call "SetLocaleInfoA" with stdcall linkage
using by value 1024
by value 14
by reference caracter
returning retcode.
cancel "SetLocaleInfoA".
*>... Seteo en Windows el separador de miles
move spaces to caracter.
move "." to caracter(1:1).
move X"00" to caracter(2:1).
call "SetLocaleInfoA" with stdcall linkage
using by value 1024
by value 15
by reference caracter
returning retcode.
cancel "SetLocaleInfoA".
pone-punto.
*>... Seteo en Windows el separador decimal
move spaces to caracter.
move "." to caracter(1:1).
move X"00" to caracter(2:1).
call "SetLocaleInfoA" with stdcall linkage
using by value 1024
by value 14
by reference caracter
returning retcode.
cancel "SetLocaleInfoA".
*>... Seteo en Windows el separador de miles
move spaces to caracter.
move "," to caracter(1:1).
move X"00" to caracter(2:1).
call "SetLocaleInfoA" with stdcall linkage
using by value 1024
by value 15
by reference caracter
returning retcode.
cancel "SetLocaleInfoA".
Marcadores