From 10e044f429ed37180de9492e02407516d77057d4 Mon Sep 17 00:00:00 2001 From: Liam Barry Allan Date: Sat, 7 May 2022 12:01:51 -0400 Subject: [PATCH] Fix incorrect lengths of packed and varying (#81) --- src/language/models/fixed.js | 2 +- src/parser.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/language/models/fixed.js b/src/language/models/fixed.js index f28fe858..eeeb39e8 100644 --- a/src/language/models/fixed.js +++ b/src/language/models/fixed.js @@ -161,7 +161,7 @@ exports.getPrettyType = (lineData) => { case `P`: if (lineData.pos != ``) { // When using positions packed lineData.length is one less than double the bytes - outType = `Packed` + `(` + String(Number(lineData.len)*2-1) + `:` + lineData.decimals + `)`; + outType = `Packed` + `(` + String(Number(lineData.len)) + `:` + lineData.decimals + `)`; } else { // Not using positions, then the lineData.length is correct outType = `Packed` + `(` + lineData.len + `:` + lineData.decimals + `)`; diff --git a/src/parser.js b/src/parser.js index 46d3ab8d..88ff7fc6 100644 --- a/src/parser.js +++ b/src/parser.js @@ -76,6 +76,10 @@ const fetchTables = async (table, aliases) => { const currentSubfield = new Declaration(`subitem`); currentSubfield.name = name; + const keywords = []; + + if (row.WHVARL === `Y`) keywords.push(`VARYING`); + currentSubfield.keywords = [Fixed.getPrettyType({ type, len: digits === 0 ? strLength : digits,