/*--------------------------------------------------------------*/ /* Call COBOL Explorer with the following parameters: */ /* */ /* REQUIRED PARMS: */ /* */ /* fname work file name */ /* /S CSA invoked by SPF */ /* /Nn /N0 = no numbers, /N1 = COBOL numbers in 1-6 */ /* /Ln ordinal line number of top line on screen */ /* /Cn ordinal column number (base 1) */ /* /Rn ordinal row number from top line (base 1) */ /* /Ffname full path name of source file */ /* */ /* On return, file \SPFPC30\COBOLSPF.DSK contains: */ /* */ /* Record 1: file name */ /* Record 2: 0 = not-modified, 1=modified */ /* Record 3: display top line number */ /* Record 4: display column number */ /* Record 5: display row number */ /* */ /*--------------------------------------------------------------*/ debug = false 'isredit macro' 'isredit (cursor_line,cursor_col) = cursor' 'isredit (top_line,bot_line) = display_lines' 'isredit (num_mode,temp_var) = number' parse value temp_var with v1 num_type v2 if num_mode = 'ON' & num_type = 'COBOL' then do x_offset = 6 num_flag = '/n1' end else do x_offset = 0 num_flag = '/n0' end 'isredit (zdsn) = dataset' temp_name = '$SPFTEMP' if cursor_line = 0 then do cursor_line = 1 end if cursor_col = 0 then do cursor_col = 1 end if top_line = 0 then do top_line = 1 end top_line = top_line + 0 /* strip leading zeroes */ cursor_x = cursor_col + x_offset /* ordinal data column */ cursor_y = cursor_line - top_line + 1 /* ordinal data line */ /* copy current contents of edit file to external file $SPFTEMP */ 'isredit replace' temp_name '.zfirst .zlast' /* ZOS and ZSPFHOME to set .EXE file name */ 'ISPEXEC VGET ZOS' 'ISPEXEC VGET ZSPFHOME' 'ISPEXEC VGET ZSPFPATH' /* parse last char */ last_char = right(zspfhome,1) if last_char <> '\' then do /* append backslash to .EXE file directory */ zspfhome = zspfhome || '\' end if debug = true then do say ' ' /* blank line */ say 'back' zspfhome || 'csa' || zos temp_name '/s' num_flag '/l' || top_line '/c' || cursor_x '/r' || cursor_y '/f' || zdsn say ' ' /* blank line */ say 'Press ENTER to continue.' parse pull end /* invoke CSA on $SPFTEMP */ 'isredit back' zspfhome || 'csa' || zos temp_name '/s' num_flag '/l' || top_line '/c' || cursor_x '/r' || cursor_y '/f' || zdsn /* read CSA desktop state info */ /* parse last char */ last_char = right(zspfpath,1) if last_char <> '\' then do /* append backslash to path */ zspfpath = zspfpath || '\' end csa_state = zspfpath || 'cobolspf.dsk' csa_file_name = linein(csa_state) /* line 1 = file name */ if csa_file_name <> '' then do csa_modified = linein(csa_state) /* line 2 = modified flag */ csa_top_line = linein(csa_state) /* line 3 = ordinal line number */ csa_cursor_x = linein(csa_state) /* line 4 = column number */ csa_cursor_y = linein(csa_state) /* line 5 = row number */ if debug = true then do say ' ' /* insure at start of line */ say overlay(' ',' ',1,79) /* blank line */ temp = 'file name = "' || csa_file_name || '"' say overlay(temp,' ',1,79) temp = 'modified = "' || csa_modified || '"' say overlay(temp,' ',1,79) temp = 'top line = "' || csa_top_line || '"' say overlay(temp,' ',1,79) temp = 'cursor x = "' || csa_cursor_x || '"' say overlay(temp,' ',1,79) temp = 'cursor y = "' || csa_cursor_y || '"' say overlay(temp,' ',1,79) say overlay(' ',' ',1,79) /* blank line */ say overlay('Press ENTER to continue.',' ',1,79) say overlay(' ',' ',1,79) /* blank line */ parse pull end if csa_file_name = temp_name then do /*-----------------------------*/ /* csa returned same file name */ /*-----------------------------*/ if csa_modified = 1 then do /* file modified, refresh from work file */ 'isredit delete .zfirst .zlast' 'isredit copy' temp_name end /* set current SPF line, and SPF cursor x/y */ if num_mode = 'ON' then do cursor_x = csa_cursor_x - 6 /* ordinal column number */ end else do cursor_x = csa_cursor_x - 7 /* ordinal column number */ end if csa_cursor_y > 2 then do 'isredit locate' csa_top_line active_line = csa_top_line + csa_cursor_y active_line = active_line - 2 'isredit cursor =' active_line cursor_x end else do 'isredit cursor =' csa_top_line cursor_x 'isredit down 1' end end else do /*----------------------------------*/ /* csa returned different file name */ /*----------------------------------*/ 'isredit back copy' temp_name zdsn '>nul' /* copy in case changed */ say '' /* start new line */ say '' /* blank line */ say 'In csa you changed to file:' csa_file_name say 'File' zdsn 'has been saved.' say 'This edit session will be terminated.' 'isredit cancel' end end else do say 'Unable to read' csa_state say 'This edit session will be terminated.' 'isredit cancel' end