Could you show us a couple things you tried along with any errors? A *LDA rarely has an external description at many sites and I haven't worked where any were used in the past decade.
I have ideas and can run some tests, but it'd be easier if I knew ahead of time what won't work and why not.
Tom
This might be what you are looking for:
http://www.bmeyers.net/faqs/15-faqs/36-defining-a-data-area-data-structure
the data area is defined as Tom said in 'D' specs
and in used in free format with IN and OUT.
Phil
d LDA euds dtaara(*lda)
d extname(F98LDA)
in lda; // *DTAARA DEFINE *LDA
#$ics = $$$cm;
Thanks to all that answered my question. I have found that the problem was not with the LDA Definition but was due to some setup issues.
you'll find here a module working with every dtaara. you have just to record in xml shape the format to cut the dtaara and the form to display or edit fields:
h OPTION(*NODEBUGIO:*SRCSTMT ) nomain h BndDir('U6ENV':'U6FMT':'U6FORM':'U6INT':'U6MSG':'U6SCREEN':'U6TREE'
h :'U6XML':'U6IFS')
//‚Screen definition
fdtafmtwwd cf e WORKSTN infds(wsds) sfile(sfl1:SFLRRN)
/copy cpy,u6ibm_h
/copy cpy,u6env_h
/copy cpy,u6fmt_h
/copy cpy,u6form_h
/copy cpy,u6int_h
/copy cpy,u6ifs_h
/copy cpy,u6msg_h
/copy cpy,u6screen_h
/copy cpy,u6tree_h
/copy cpy,u6xml_h
//‚for refresh the screen
d dtafmt_refresh s n export inz(*off)
//‚Screen NO
d dtafmt_screen s 3u 0 export
//‚Structures for screen process
d tRow ds qualified template
d lControl *
d NO 5U 0
*
*
d dspXin ds
D pxin01 * inz(%addr(xin01))
d pxin02 * inz(%addr(xin02))
d pxin03 * inz(%addr(xin03))
d pxin04 * inz(%addr(xin04))
d pxin05 * inz(%addr(xin05))
d pXIN * dim(70) overlay(dspxin:1)
//‚for editing numeric field
d tdsEditedField ds template qualified
d val 32
d len 3u 0
//‚Global fields
d G ds qualified
d lForm *
d row likeds(tRow) dim(22)
d Row1 likeds(tRow) inz
d Row1_b4 likeds(tRow) inz
d Row9 likeds(tRow) inz
d Row9_b4 likeds(tRow) inz
d change n
d lActions *
d lFormats *
//‚--------------------------------------------------------------------
//‚init
//‚--------------------------------------------------------------------
pdtafmt_init b export
d dtafmt_init pi
d lActions *
/free
//‚Load standard function keys -
screen_SetAction(lActions:x'33':'0':%pAddr(F3):'F3=Exit');
screen_SetAction(lActions:x'37':'1':%pAddr(F7):'F7=Formula ');
screen_SetAction(lActions:x'3a':'1':%pAddr(f10):'F10=Move to top');
screen_SetAction(lActions:x'f1':'1':%pAddr(Enter));
screen_SetAction(lActions:x'f4':*ON :%pAddr(rollUP ));
screen_SetAction(lActions:x'f5':*ON :%pAddr(rolldown));
g.lActions=lActions;
/end-free
p e
//‚--------------------------------------------------------------------
//‚load format
//‚--------------------------------------------------------------------
pdtafmt_setFmt b export
d dtafmt_setFmt pi
d lFormats *
d formatID 10a const varying
d pBuffer * const
d fmtLen 5u 0 options(*nopass)
*
d lFormat s *
d format ds likeDs(tFormat) based(pFormat)
/free
lFormat=fmt_getFormat(lFormats:formatID);
if lFormat<>*null;
pFormat=tree_getItem(lFormat);
format.pBuffer1=pBuffer;
//‚Length of the format if requested -
if %parms=4;
fmtLen=format.len;
endif;
endIf;
g.lFormats=lFormats;
/end-free
p e
//‚--------------------------------------------------------------------
//‚main
//‚--------------------------------------------------------------------
pdtaFmt_display b export
d dtaFmt_display pi
d pgmid_ 10
d FormID 10A varying const
/free
zFK=screen_getfkentitle(g.lActions);
pgmid=pgmid_;
msg_SndPM(pgmid:env_getWelcomeMessage());
//
g.lForm=tree_Xml2Tree(env_getFileName(cForm:formId)
:%pAddr(FORM_XMLinput));
this_rtvForm();
interact();
/end-free
p e
//‚--------------------------------------------------------------------
//‚load formulas in form (browse all label in form) -
//‚--------------------------------------------------------------------
pthis_rtvForm...
p b
d lX s *
d label ds likeDs(tLabel) based(pLabel)
/free
lX=tree_getFirst(g.lForm);
dow lX<>*null;
if tree_isOfTheKind(kLabel:lX:pLabel);
this_rtvForm2(label);
endIf;
lX=tree_getNexttoDisplay(lX);
endDo;
/end-free
p e
//‚--------------------------------------------------------------------
//‚load formula in form (find field in all loaded formats) -
//‚--------------------------------------------------------------------
pthis_rtvForm2 b
d this_rtvForm2 pi
d label likeds(tLabel)
*
d lFormat s *
d format ds likeDs(tFormat) based(pFormat)
d lField s *
d msg s 130a varying
d field ds likeDs(tField) based(pField)
/free
lFormat=tree_getFirst(g.lFormats);
dow lFormat<>*null;
lField=tree_getItemFromList(lformat:kField:label.formula);
if lField<>*null;
leave;
endif;
lFormat=tree_getnext(lFormat);
endDo;
//
if lField<>*null;
pFormat=tree_getItem(lFormat);
pField=tree_getItem(lField);
label.det(1).pValue=int_getStringFromField(lField
:lFormat
:format.pBuffer1
:label.det(1).owned
:Label.det(1).len);
else;
msg='Field "%1" has not been found';
label.det(1).pValue=
int_allocString(int_replaceAll(msg:label.formula)
:label.det(1).owned
:label.det(1).len);
endIf;
/end-free
p e
//‚--------------------------------------------------------------------
//‚interact
//‚--------------------------------------------------------------------
pinteract b
/free
dtafmt_Screen=1;
g.row1.lControl=tree_GetFirstToDisplay(g.lForm);
g.Row1.NO=0;
//‚Work screens
wrkScreen();
/end-free
p e
//‚--------------------------------------------------------------------
//‚work screens
//‚--------------------------------------------------------------------
p wrkScreen b
/free
dow dtafmt_screen>0;
if dtafmt_screen=1;
Screen1();
endif;
endDo;
/end-free
p e
//‚--------------------------------------------------------------------
//‚Screen 1 - display form
//‚--------------------------------------------------------------------
p Screen1 b
d RowY ds likeDs(tRow)
d fkProcess pr extproc(pAction)
d pAction s * procptr
d fcontrol s n
/free
if g.row9<>g.row9_b4;
g.row1=Sync(g.row9);
endIf;
//‚Load rows
if g.row1<>g.row1_b4 or dtafmt_refresh;
loadRows();
g.row1_B4=g.row1;
dtafmt_refresh=*off;
endIf;
//‚more item or bottom of list
rowY=getNextRow(g.row9);
if rowY.lControl=*null;
mySflEnd='Bottom';
else;
mySflEnd='More...';
endIf;
//‚write and read screen formats
write msgctl;
write hdr1;
if SflRRN=0;
write sfl0;
else;
*in88=*on;
endif;
*in89=*off;
write ctl1;
read hdr1;
read ctl1;
//‚Clear messages
msg_RmvPM(pgmID);
//‚PROCESS OF FUNCTION KEYS BEFORE CONTROL
pAction=screen_getActionfromKey(g.lActions:wsds.kp:fControl);
if pAction=*null;
msg_SndPM(pgmID:'Function key invalid.');
else;
if fControl;
control();
endIf;
fkProcess();
endIf;
/end-free
p e
//‚-----------------------------------------------------------------------
//‚Enter
//‚-----------------------------------------------------------------------
p Enter b
/free
if not g.change;
msg_SndPM(pgmID:'Type a function key to continue.');
endIf;
/end-free
p e
//‚-----------------------------------------------------------------------
//‚F3=Exit
//‚-----------------------------------------------------------------------
p f3 b
/free
dtafmt_screen=0;
/end-free
p e
//‚-----------------------------------------------------------------------
//‚F7=Formula/F7=no Formula
//‚-----------------------------------------------------------------------
p f7 b
/free
if %scan('F7=Formula':ZFK)>0;
ZFK=int_scanrpl('F7=Formula ':'F7=No Formula':ZFK);
else;
ZFK=int_scanrpl('F7=No Formula':'F7=Formula ':ZFK);
endIf;
g.row1_b4.lControl=*null;
/end-free
p e
//‚-----------------------------------------------------------------------
//‚F10=Move to top
//‚-----------------------------------------------------------------------
p f10 b
/free
if SFLCSRRRN=0;
msg_SndPM(pgmID:'Wrong cursor position.');
else;
g.row1=g.row(sflcsrrrn);
endIf;
/end-free
p e
//‚-----------------------------------------------------------------------
//‚ROLLup
//‚-----------------------------------------------------------------------
p RollUp b
/free
if g.row1.lControl=tree_GetFirstToDisplay(g.lForm)
and g.row1.NO=0;
msg_SndPM(pgmID:'You have reached the top of the list.');
else;
g.row9=getPrevRow(g.row1);
endIf;
/end-free
p e
//‚-----------------------------------------------------------------------
//‚ROLLDOWN
//‚-----------------------------------------------------------------------
p Rolldown b
/free
if mySflEnd='Bottom';
msg_SndPM(pgmID:'You have reached the bottom of the list.');
else;
g.row1=getNextRow(g.row9);
endif;
/end-free
p e
//‚-----------------------------------------------------------------------
//‚load rows
//‚-----------------------------------------------------------------------
ploadRows b
/free
d form ds likeds(tForm) based(pForm)
d Rowx ds likeds(tRow)
d panel ds likeds(tPanel) based(pPanel)
d label ds likeds(tLabel) based(pLabel)
d pLabel££ s * inz(*null)
d lenToSee s 3u 0
d i s 3u 0
d pX s *
//‚*) load title
pForm=tree_getItem(G.lForm);
zTitle=Form.text;
*in88=*off;
*in89=*on;
WRITE ctl1;
//‚*) clear work area s
clear g.row;
//‚*) Load parent panel s
rowx.lControl=tree_getParent(g.row1.lControl);
if RowX.lControl<>g.lForm;
Rowx.NO=0;
g.row(1)=Rowx;
endIf;
//‚*) Load next s
Rowx=g.row1;
for i=tree_getlevel(g.row1.lControl) to 22;
g.row(i)=Rowx;
Rowx=getNextRow(Rowx);
if Rowx.lControl=*null;
leave;
endIf;
endFor;
//‚*) Load subfile
for SflRRN=1 to 22;
clear sfl1 ;
%subArr(*in:1:71)=*off;
if g.row(SflRRN).lControl=*Null;
leave;
endIf;
Rowx=g.row(sflRRN);
g.row9=RowX;
//‚item is label
if tree_isoftheKind(kLabel:RowX.lControl:pLabel);
//‚Out label text
if pLabel<>pLabel££;
pLabel££=pLabel;
xText=int_AddSpaceDot(' '+Label.text:52);
//‚formula
if %scan('F7=No Formula':ZFK)>0;
%subst(xtext:60-%len(label.formula)-1)='['+label.formula+']';
endIf;
endif;
//‚Out label/field value
lentosee=int_getmin(70:label.det(1).len-rowX.NO*70);
if label.input and not label.det(1).owned;
pX=pXin(lenToSee);
*in71=*on;
*in(lenToSee)=*on;
else;
pX=%addr(xOut);
endIf;
ifs_memCpy(pX
:label.det(1).pValue+70*rowX.NO
:lenToSee);
elseif tree_isoftheKind(kPanel:RowX.lControl:pPanel);
xText=Panel.text;
endIf;
write sfl1;
endFor;
g.row9_b4=g.row9;
/end-free
p e
//‚-----------------------------------------------------------------------
//‚get next row to display
//‚-----------------------------------------------------------------------
pgetNextRow b
d getNextRow pi likeDs(tRow)
d RowX likeDs(tRow) const
*
d RowY ds likeDs(tRow)
d label ds likeDS(tLabel) based(pLabel)
d field ds likeDS(tField) based(pField)
/free
If tree_isOfTheKind(kLabel:rowx.lControl:pLabel);
if (1+rowX.NO)*70<label.det(1).len;
rowY=rowX;
rowY.NO+=1;
return rowY;
endif;
endIf;
RowY.lControl=tree_getNextToDisplay(rowx.lControl);
RowY.NO=0;
return rowY;
/end-free
p e
//‚-----------------------------------------------------------------------
//‚get previous row to display
//‚-----------------------------------------------------------------------
pgetPrevRow...
p b
d getPrevRow...
d pi likeDs(tRow)
d RowX likeDs(tRow) const
*
d RowY ds likeDs(tRow) inz
d label ds likeDS(tLabel) based(pLabel)
d field ds likeDS(tField) based(pField)
d len s 5u 0 inz(%len(xout))
/free
if tree_getKind(rowx.lControl)=kLabel and rowx.NO>0;
rowY=rowX;
rowY.NO-=1;
return rowY;
endIf;
rowY=rowX;
RowY.lControl=tree_getPrevtoDisplay(rowx.lControl);
if tree_getkind(rowY.lControl)=kPanel;
rowY.NO=0;
elseif tree_isoftheKind(kLabel:rowx.lcontrol:pLabel);
rowY.NO=%int((label.det(1).len-1)/70);
endIf;
return rowY;
/end-free
p e
//‚-----------------------------------------------------------------------
//‚control
//‚-----------------------------------------------------------------------
p control b
*
d Rowx ds likeds(tRow)
d label ds likeDs(tLabel) based(pLabel)
d lenToSee s 3u 0
/free
readc sfl1;
dow not %eof();
rowX=g.row(sflrrn);
if tree_isofthekind(kLabel:rowX.lControl:pLabel);
lenToSee=int_getmin(70:label.det(1).len-rowX.NO*70);
ifs_memCpy(label.det(1).pValue+70*rowX.NO
:pXin(lenToSee)
:lenToSee);
endif;
readc sfl1;
endDo;
/end-free
p e
//‚-----------------------------------------------------------------------
//‚sync
//‚-----------------------------------------------------------------------
p sync b
d sync pi likeDs(tRow)
d rowX likeDs(tRow) const
*
d NO s 3u 0
d level s 3u 0
d rowY ds likeDs(tRow)
d rowZ ds likeDs(tRow)
/free
rowY=RowX;
rowZ=RowX;
for NO=22 downto 1;
if rowZ.lControl=*null;
leave;
endIf;
level=tree_getLevel(rowz.lControl);
if level=0 or level>NO;
leave;
endIf;
RowY=rowZ;
rowZ=getPrevRow(rowY);
endfor;
return rowY;
/end-free
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!
Discuss This Question: 7  Replies
Here is an example in /FREE
// * -----------------------------------------------------------------
// * Printer Data Area
// * -----------------------------------------------------------------
DCL-DS Label_Prt DTAARA('LblPrntr');
Label_Printer Char(10) Pos(1);
END-DS;
One other thing use all upper case for the data area name my example did not have that so it really should be
DCL-DS Label_Prt DTAARA('LBLPRNTR');
Label_Printer Char(10) Pos(1);
END-DS;
you have just to record in xml shape the format to cut the dtaara and the form to display or edit fields:
h OPTION(*NODEBUGIO:*SRCSTMT ) nomain
h
BndDir('U6ENV':'U6FMT':'U6FORM':'U6INT':'U6MSG':'U6SCREEN':'U6TREE' p e