diff --git a/CobXmlSupport/GenCobCode.cs b/CobXmlSupport/GenCobCode.cs index d0cd006..9410179 100644 --- a/CobXmlSupport/GenCobCode.cs +++ b/CobXmlSupport/GenCobCode.cs @@ -917,8 +917,16 @@ namespace CobXmlSupport } else { - CreateMoveFromData(); - fromMoves.Show(); + if (!chkDisplays.Checked) + { + createXMLMoveCode(true); + } + else + { + + CreateMoveFromData(); + fromMoves.Show(); + } } } @@ -1331,7 +1339,7 @@ namespace CobXmlSupport fromMoves.CodeShower.Text += "\r\n IF " + cr.CountIn; if (occParRows.Length > 0) { - fromMoves.CodeShower.Text += occParRows + " )"; + fromMoves.CodeShower.Text += "( "+ occParRows + " )"; } fromMoves.CodeShower.Text += "\r\n > 0"; @@ -1348,7 +1356,7 @@ namespace CobXmlSupport } if (occParRows.Length > 0) { - fromMoves.CodeShower.Text += occParRows + " )"; + fromMoves.CodeShower.Text += "( " + occParRows + " )"; } fromMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + "TO "; if (cr.FieldDef.ToUpper().IndexOf("X") > -1) @@ -1412,6 +1420,7 @@ namespace CobXmlSupport { fromMoves.CodeShower.Text += crtmp.wrapped() + "\r\n"; }); + } private string reduceIndList(string aktIndList, string indTemp) @@ -1498,7 +1507,7 @@ namespace CobXmlSupport } fromToMoves.CodeShower.Text += slask4; - // aktIndList = reduceIndList(aktIndList, indTemp); nödvändig ? + // aktIndList = reduceIndList(aktIndList, indTemp); nödvändig ? // Until here--- valueSwitch = cr.FieldName.Contains("_Valu") || cr.isOccurs; @@ -1691,7 +1700,7 @@ namespace CobXmlSupport } - private void createXMLMoveCode() + private void createXMLMoveCode(bool justOut = false) { bool loopTyp = false; @@ -1740,9 +1749,12 @@ namespace CobXmlSupport { foreach (string indTxt in indSt.NewInds) { - //Before perform varying, move the count-value from old structure to new - fromToMoves.CodeShower.Text += " MOVE " + tmpQfh.qualCobRow.CountIn + "\r\n" + tmpQfh.indexRedText; - fromToMoves.CodeShower.Text += " TO " + tmpQfh.qualCobRow.CountIn.ToString().Replace(S.ettingPrefix, S.ettingExpPrefix) + "\r\n" + tmpQfh.indexRedText; + 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; + fromToMoves.CodeShower.Text += " TO " + tmpQfh.qualCobRow.CountIn.ToString().Replace(S.ettingPrefix, S.ettingExpPrefix) + "\r\n" + tmpQfh.indexRedText; + } //Perform fromToMoves.CodeShower.Text += " PERFORM VARYING " + indTxt + " FROM 1 BY 1\r\n UNTIL " + indTxt + "\r\n > " + tmpQfh.qualCobRow.CountIn.ToString() + "\r\n" + tmpQfh.indexRedText; @@ -1759,16 +1771,26 @@ namespace CobXmlSupport } //The acutal move of present fields fromToMoves.CodeShower.Text += " MOVE " + tmpQfh.ToString(); - fromToMoves.CodeShower.Text += " TO " + tmpQfh.ToExpString(); - - if (tmpQfh.qualCobRow.FieldName.ToUpper().Contains("_VALUE")) { } + if (!justOut) + { + fromToMoves.CodeShower.Text += " TO " + tmpQfh.ToExpString(); + } else { - fromToMoves.CodeShower.Text += " MOVE " + tmpQfh.qualCobRow.CountIn + "\r\n" + (string)(loopTyp ? tmpQfh.indexRedText : tmpQfh.indexText); - fromToMoves.CodeShower.Text += " TO " + tmpQfh.qualCobRow.CountIn.ToString().Replace(S.ettingPrefix, S.ettingExpPrefix) + "\r\n" + (string)(loopTyp ? tmpQfh.indexRedText : tmpQfh.indexText); - fromToMoves.CodeShower.Text += " ELSE\r\n"; - fromToMoves.CodeShower.Text += " MOVE 0 TO " + tmpQfh.qualCobRow.CountIn.ToString().Replace(S.ettingPrefix, S.ettingExpPrefix) + "\r\n" + (string)(loopTyp ? tmpQfh.indexRedText : tmpQfh.indexText); - fromToMoves.CodeShower.Text += " END-IF\r\n"; + fromToMoves.CodeShower.Text += " TO " + (string)(tmpQfh.qualCobRow.FieldDef.ToUpper().Contains("X") ? "MoveToStringVar" : "MoveToNumVar") + "\r\n"; + } + + if (!justOut) + { + if (tmpQfh.qualCobRow.FieldName.ToUpper().Contains("_VALUE")) { } + else + { + fromToMoves.CodeShower.Text += " MOVE " + tmpQfh.qualCobRow.CountIn + "\r\n" + (string)(loopTyp ? tmpQfh.indexRedText : tmpQfh.indexText); + fromToMoves.CodeShower.Text += " TO " + tmpQfh.qualCobRow.CountIn.ToString().Replace(S.ettingPrefix, S.ettingExpPrefix) + "\r\n" + (string)(loopTyp ? tmpQfh.indexRedText : tmpQfh.indexText); + fromToMoves.CodeShower.Text += " ELSE\r\n"; + fromToMoves.CodeShower.Text += " MOVE 0 TO " + tmpQfh.qualCobRow.CountIn.ToString().Replace(S.ettingPrefix, S.ettingExpPrefix) + "\r\n" + (string)(loopTyp ? tmpQfh.indexRedText : tmpQfh.indexText); + fromToMoves.CodeShower.Text += " END-IF\r\n"; + } } } @@ -1802,7 +1824,8 @@ namespace CobXmlSupport fromToMoves.Parent = this; fromToMoves.Labeltext = "Cobol \"reserved\" Words"; - foreach(string str in CobResWords.ToArray()) { + foreach (string str in CobResWords.ToArray()) + { if (fromToMoves.CodeShower.Text == "") { } else fromToMoves.CodeShower.Text += "\r\n"; fromToMoves.CodeShower.Text += str; @@ -1812,7 +1835,8 @@ namespace CobXmlSupport //createXMLMoveCode(); } - private void loadResWords(){ + private void loadResWords() + { string number = ""; CobResWords = new List(); for (int i = 0; i < 700; i++)