Skip to content

Commit

Permalink
Fix incorrect lengths of packed and varying (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
worksofliam committed May 7, 2022
1 parent 8528b17 commit 10e044f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/language/models/fixed.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 + `)`;
Expand Down
4 changes: 4 additions & 0 deletions src/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 10e044f

Please sign in to comment.