Defined occurs when exists, init right index when looping in xml

This commit is contained in:
2015-07-29 15:18:56 +02:00
parent 8e65a50c3c
commit f0449c6874
2 changed files with 18 additions and 6 deletions

View File

@ -752,6 +752,7 @@ namespace CobXmlSupport
chkDisplays.Checked = true;
chkWrap.Checked = true;
chkNewArea.Checked = false;
//chkNewArea.Checked = true;
ClientSizeMinWidth = this.ClientSize.Width;
@ -879,7 +880,7 @@ namespace CobXmlSupport
private void btnGenICodeNew_Click(object sender, EventArgs e)
{
bool justOut = true;
bool loopTyp = false;
//bool loopTyp = false;
Dictionary<string, string> indexNames = new Dictionary<string, string>();
string IndVarText = " *--------------------------------------------------*\r\n * Extra indexvariabler för occurs-taggar --------*\r\n *--------------------------------------------------*";
@ -1919,7 +1920,7 @@ namespace CobXmlSupport
SF.idConnect = "0A975654-75C6-4A8C-8534-AA16F46BC740";
SF.usageName = S.ettingActualFile.Substring(0, S.ettingActualFile.LastIndexOf(".")) + "_Transfer";
SF.fNameSaved = S.ettingActualFile.Substring(0, S.ettingActualFile.LastIndexOf(".")) + "_Transfer.cbl";
fromMoves.SavedFile = SF;
fromToMoves.SavedFile = SF;
bool adj = false;
bool valueSwitch = false;
@ -2229,9 +2230,11 @@ namespace CobXmlSupport
if (!justOut)
{
//Before perform varying, move the count-value from old structure to new
fromToMoves.CodeShower.Text += " MOVE " + tmpQfh.qualCobRow.CountIn + "\r\n" + tmpQfh.indexRedText;
string chosenKey = testIndexes.FirstOrDefault(x => x.Value == indTxt).Key; // indexes = <FieldName , FieldIndex> search FieldName from present FieldIndex
qualifieldhlp locTmpQfh = qldList.First(x => x.qualCobRow.FieldName == chosenKey); // Find QualifiedHelp-object for right field
fromToMoves.CodeShower.Text += " MOVE " + locTmpQfh.qualCobRow.CountIn + "\r\n" + locTmpQfh.indexRedText;
fromToMoves.CodeShower.Text += " TO " +
tmpQfh.qualCobRow.CountIn.ToString().Replace(S.ettingPrefix, S.ettingExpPrefix) + "\r\n" + tmpQfh.indexRedText;
locTmpQfh.qualCobRow.CountIn.ToString().Replace(S.ettingPrefix, S.ettingExpPrefix) + "\r\n" + locTmpQfh.indexRedText;
}
//Perform
fromToMoves.CodeShower.Text += " PERFORM VARYING " + indTxt + " FROM 1 BY 1\r\n UNTIL " +
@ -2346,7 +2349,7 @@ namespace CobXmlSupport
fromToMoves.Show();
//createXMLMoveCode();
func_exit: ;
//func_exit: ;
}
private void loadResWords()

View File

@ -83,18 +83,27 @@ namespace CobXmlSupport
if(!latestList.Contains(wrkList[i])){
string countVar = "";
string tagName = "";
int occNum = 0;
if (!wrkList[i].Equals(""))
{
string chosenKey = indexes.FirstOrDefault(x => x.Value == wrkList[i]).Key; // indexes = <FieldName , FieldIndex> search FieldName from present FieldIndex
countVar = rows.First(x => x.FieldName == chosenKey).CountIn; // from cobrows find "Count In"-variable for given FieldName
tagName = rows.First(x => x.FieldName == chosenKey).TagName; // from cobrows find "xmltag" for given FieldName
occNum = rows.First(x => x.FieldName == chosenKey).occNum;
string inLst = "";
int j = i + 1;
//genCode += "\r\n *>" + wrkString;
if (inOut) // When moving to cobol xml structure
{
if (occNum.ToString() != S.ettingMaxOcc && occNum!=0)
{
genCode += "\r\n MOVE " + occNum.ToString() + " TO " + countVar;
}
else
{
genCode += "\r\n MOVE " + S.ettingMaxOcc + " TO " + countVar;
}
// genCode += "\r\n MOVE 0 TO " + countVar;
while (wrkList.Length > j)
{