i'm converting a program to full free format but don't know how to replace a data structure with fixed positions. and i cant find a good example online also.
i have 2 data structures like below. i tried
dcl-ds bl dim(12)
bl01 char(7);
bl02 char(7);
...
end-ds
and
dcl-s bl char(7) dim(12);
this is the part that i try to convert
//*************************************************************************
// NORMAL DATA STRUCTURES *
//*************************************************************************
D DS
D BL 1 84
D DIM(12) BARCODE LABEL
D BL01 1 7
D BL02 8 14
D BL03 15 21
D BL04 22 28
D BL05 29 35
D BL06 36 42
D BL07 43 49
D BL08 50 56
D BL09 57 63
D BL10 64 70
D BL11 71 77
D BL12 78 84
D DS
D TL 1 72
D DIM(12) TEXT LABEL
D TL01 1 6
D TL02 7 12
D TL03 13 18
D TL04 19 24
D TL05 25 30
D TL06 31 36
D TL07 37 42
D TL08 43 48
D TL09 49 54
D TL10 55 60
D TL11 61 66
D TL12 67 72
Thanks in advance
EDIT: Do not use the first option here. Leaving answer here as is because it is good to note when an option is incorrect.
You have two options here. You can use either pos
or overlay
. overlay
positions relative to another field while pos
is an absolution position.
dcl-ds *n;
bl char(7) dim(12);
bl01 char(7) overlay(bl);
bl02 char(7) overlay(bl:*next);
bl03 char(7) overlay(bl:*next);
bl04 char(7) overlay(bl:*next);
bl05 char(7) overlay(bl:*next);
bl06 char(7) overlay(bl:*next);
bl07 char(7) overlay(bl:*next);
bl08 char(7) overlay(bl:*next);
bl09 char(7) overlay(bl:*next);
bl10 char(7) overlay(bl:*next);
bl11 char(7) overlay(bl:*next);
bl12 char(7) overlay(bl:*next);
end-ds;
The other option:
dcl-ds *n;
bl char(7) dim(12) pos(1);
bl01 char(7) pos(1);
bl02 char(7) pos(8);
bl03 char(7) pos(15);
...
end-ds;