Untitled
unknown
plain_text
a year ago
7.8 kB
8
Indexable
def get_code_intended(self,df):
df['indentation'] = 0
for index, row in df.iterrows():
if pd.notna(row['Conditional_Seq']):
matching_row = df[df['Sequence'] == str(int(float(row['Conditional_Seq'])))]
if not matching_row.empty:
df.loc[index, 'indentation'] = matching_row['indentation'].iloc[0] + 1
df = self.set_indentation_for_if_statements_new(df)
for index, row in df.iterrows():
if 'END' in row.Keywords:
conditional_seq = str(int(float(row['Conditional_Seq'])))
if pd.notna(conditional_seq):
matching_if_row = df[df['Sequence'] == conditional_seq]
if not matching_if_row.empty:
df.loc[index, 'indentation'] = matching_if_row['indentation'].iloc[0]
result = []
for i, d in df.iterrows():
idx = str(d.Sequence).zfill(6)
statement = d.Statement
indentation = d.indentation * " "
result.append(f'{idx} {indentation}{statement}')
print("\n\nPRINTING MASTER PEICE :\n\n\n")
for line in result:
print(line)
return result
Input printed row by row
Sequence 8
Statement IF NOT LS-ABK-EPIC-CODE = 'I ' OR 'P'
Program_Name PAJSFN20
Paragraph_Name 0000-MAINLINE.
Keywords IF
Conditional_Seq None
Parameters [{'logical_operator': '', 'attribute': 'LS-ABK-EPIC-CODE', 'operator': '=', 'value': 'I '}, {'logical_operator': 'OR', 'attribute': 'LS-ABK-EPIC-CODE', 'operator': 'boolean', 'value': 'P'}]
Source None
Target None
Name: 0, dtype: object
Sequence 17
Statement IF WS-SET-E1051-SUSP-IND = 'Y'
Program_Name PAJSFN20
Paragraph_Name 0000-MAINLINE.
Keywords IF
Conditional_Seq 10.0
Parameters [{'logical_operator': '', 'attribute': 'WS-SET-E1051-SUSP-IND', 'operator': '=', 'value': 'Y'}]
Source None
Target None
Name: 1, dtype: object
Sequence 18
Statement IF NOT LS-ABK-STA-CODE = 'J'
Program_Name PAJSFN20
Paragraph_Name 0000-MAINLINE.
Keywords IF
Conditional_Seq 17.0
Parameters [{'logical_operator': '', 'attribute': 'LS-ABK-STA-CODE', 'operator': '=', 'value': 'J'}]
Source None
Target None
Name: 2, dtype: object
Sequence 22
Statement MOVE 'E1051' TO AIG-CODE
Program_Name PAJSFN20
Paragraph_Name 0000-MAINLINE.
Keywords MOVE
Conditional_Seq 21.0
Parameters {'Attributes': ["'E1051'"], 'Attribute_Literals': [True], 'CORRESPONDING': False, 'Values': ['AIG-CODE']}
Source ["'E1051'"]
Target ['AIG-CODE']
Name: 3, dtype: object
Sequence 24
Statement END-IF
Program_Name PAJSFN20
Paragraph_Name 0000-MAINLINE.
Keywords END
Conditional_Seq 18.0
Parameters Extractor Under DEV
Source None
Target None
Name: 4, dtype: object
Sequence 25
Statement END-IF
Program_Name PAJSFN20
Paragraph_Name 0000-MAINLINE.
Keywords END
Conditional_Seq 17.0
Parameters Extractor Under DEV
Source None
Target None
Name: 5, dtype: object
Sequence 26
Statement END-IF
Program_Name PAJSFN20
Paragraph_Name 0000-MAINLINE.
Keywords END
Conditional_Seq 8.0
Parameters Extractor Under DEV
Source None
Target None
Name: 6, dtype: object
The lines in result:
000008 IF NOT LS-ABK-EPIC-CODE = 'I ' OR 'P'
000017 IF WS-SET-E1051-SUSP-IND = 'Y'
000018 IF NOT LS-ABK-STA-CODE = 'J'
000022 MOVE 'E1051' TO AIG-CODE
000024 END-IF
000025 END-IF
000026 END-IFEditor is loading...
Leave a Comment