2024年1月13日土曜日

NEW GYOM

 [TCPLINK SCRIPT HEADER]
DESCRIPTION=Job GYOMU Code Information List(3270 Emulator)
[TCPLINK SCRIPT SOURCE]
'Option Explicit
 ' ***********************************************
 ' 機能:指定したJOBの業務コードを取得する
 ' 入力:マクロ名+_I.txt メンバ名を行列記する
 ' 出力:マクロ名+_0.CSV JOB名、業務名、有効開始 有効終了
 ' 変更履歴
 ' 2023.06.29 入力テキストに空行がある時は、処理対象としない
 ' 2023.06.30 検索一覧から効力期間に該当するレコードを出力する
 ' 2023.06.30 検索で該当なしの場合もレコードを出力する
 ' ***********************************************
   Dim emlECLPSObj
   Dim sThisSessionName, sThisMacroName
   Dim sMsg
   Dim Row, Col, Rows, Cols, CurRow, CurCol
   Dim iCnt, wCnt, wCnt_MemNfd
   Dim sMapDate
' 初期 -------------------------------------------
   Dim G_Ver:G_Ver = " 1.1 "
   Dim iDebug:iDebug = 0
   Dim lmilliseconds:lmilliseconds = 3000
   Dim lmilliseconds2:lmilliseconds2 = 1000
   Dim BeginKey:BeginKey = "V1210"
' 共通プロパティー値の設定 -----------------------
   sThisMacroName = Replace(GetCommonMacroname(),".mac","")
   sThisSessionName = GetCommonSessionName()
   Set emlECLPSObj = CreateObject("TESSC.emlECLPS")
   emlECLPSObj.SetConnectionByName(sThisSessionName)
   Dim sTitle:sTitle = sThisMacroName
   Dim IFileNm:IFileNm = sThisMacroName & "_I.txt"
   Dim OFileNm:OFileNm = sThisMacroName & "_O.CSV"
'  主処理 ----------------------------------------
If IsEnableEnv(sTitle) = False Then
   MsgBox " ヘルスチェック:利用不可です ",64,sTitle
Else
   '処理開始画面の確認
   If IsFirstMap(BeginKey) Then
      '*メンバー数分の繰返し開始
      Set fso = CreateObject("Scripting.FileSystemObject")
      If fso.FileEXISTS(IFileNm) = True Then
         Set file1 = fso.OpenTextFile(".\" & IFileNm)
         Set file2 = fso.OpenTextFile(".\" & OFileNm, 2, True)
         sMsg = " 入力テキストファイル名:" & IFileNm & vbCrLf & _
                " JOB名:" & " ******** " & vbCrLf & _
                " 出力テキストファイル名:" & OFileNm
         MyVar = MsgBox (sMsg, vbYesNo,sTitle & G_Ver)
         If MyVar = vbYES Then
            wCnt = 0:wCnt_MemNfd = 0
            '入力テキストをレコード単位に読み込む
            iCnt=0: sJobNm = ""
            Do Until file1.AtEndOfStream
               sJobNm = file1.readline
               iCnt = iCnt + 1
               '■1.J0B名を指定して実行
               If sJobNm <> "" Then
                  'ジョブ名を入力し、更新区分が照会のみの時に実行する
                  If SetMap210JobnameGo(sJobNm) = False Then
                     Exit Do
                  End If
                  SetWaitTime(lmilliseconds)         '待機する時間
                  '■2.画面「結果」から
                  '業務コードを取得しファイル出力
                  '画面の行数?列数を取得
                  Rows = emlECLPSObj.NumRows:Cols= emlECLPSObj.NumCols
                  '画面右上の現在に日付を取得して西暦4桁へ変換
                  sMapDate = GetMapCurDate
                  '効力有効な一覧情報を取得する
                  Dim sResJOBNm:sResJOBNm = ""
                  Dim sResGYOMU:sResGYOMU = ""
                  Dim sResValidS:sResValidS = ""
                  Dim sResValidE:sResValidE = ""
                  Dim iGYO:iGYO = 9
                  Dim iRTU:iRTU = 7
                  Dim iGYOMAX:iGYOMAX = 18
                  Dim iValidDay:iValidDay = 0
                  Do Until iValidDay = 1 Or _
                           emlECLPSObj.GetText(iGYO, iRTU, 8) = "" Or _
                           iGYO > iGYOMAX Or 
                           IsMapMemExsist = True
                     sResJOBNm  = emlECLPSObj.GetText(iGYO,iRTU,8)
                     sResGYOMU  = emlECLPSObj.GetText(iGYO,iRTU+10,8)
                     sResValidS = emlECLPSObj.GetText(iGYO,iRTU+20,8)
                     sResValidE = emlECLPSObj.GetText(iGYO,iRTU+30,8)
                     '
                     '2桁表示の西暦を4桁表示に変換して西暦年の範囲判定する
                     If IsValidDate(sMapDate,sResValidS,sResValidE) = True
                        iValidDay = 1         '効力有効行の時
                        Exit Do
                     End If
                     iGYO = iGYO + 1
                  Loop
                  '
                  '■3.検索結果を含めて、効力判定に従いテキストファイル出力
                  Dim sRec
                  If iValidDay = 1 Then
                     sRec = "#" & sMapDate & "," & sJobNm & "," & _
                            sResJOBNm & "," & sResGYOMU & ",#" & sResValidS & ",#" & sResValidE
                     wCnt = wCnt + 1
                  Else
                     sRec = "#" & sMapDate & "," & sJobNm & "," & _
                            sResJOBNm & "," & sResGYOMU & "," & sResValidS & "," & sResValidE
                     wCnt_MemNfd = wCnt_MemNfd + 1
                  End If
                  file2.WriteLine(sRec)
                  SetWaitTime(lmilliseconds2)     '待機する時間
               End If
            Loop
            ' 終了 -----------------------------------
            file1.Close:file2.Close
            Set fso = Nothing
            sMsg = " 処理終了               " & vbCrlf & _
                   " 入カテキストファイル名 " & IFileNm & vbCrlf & _
                   "   件数               :" & iCnt & vbCrlf & _
                   " 出力テキストファイル名 " & OFileNm & vbCrlf & _
                   "   件数(正常)       :" & wCnt & vbCrlf & _
                   "   件数(メンバ無)   :" & wCnt_MemNfd
            MsgBox sMsg, vbInformation, sTitle & G_Ver
         Else
            MsgBox " 処理続行に「いいえ」と応答した ",vbCritical,sTitle & G_Ver
         End If
      Else
         MsgBox " 入力テキストファイルが存在なし " & IFileNm,vbCritical,sTitle & G_Ver
      End If
   Else
      MsgBox " 開始画面が「V1210画面」ではない " ,vbCritical,sTitle & G_Ver
   End If
End If
' ************************************************
'  関数
' ************************************************
'   画面のメンバーなし確認 -----------------------
Function IsMapMemExsist
   Dim row:row = 24           '画面位置(行)
   Dim col:col = 12           '画面位置(列)
   Dim MemKey:MemKey = "対象レコードなし"
   
   IsMapMemExsist = True
   If emlECLPSObj.GetText(row, col, 16) = MemKey Then
      IsMapMemExsist = False
   End If
End Function
'   画面の現在日の取得 ---------------------------
Function GetMapCurDate
   Dim row:row = 1            '画面位置(行)
   Dim col:col = 63           '画面位置(列)
   Dim sMapDate:sMapDate = ""
   sMapDate = emlECLPSObj.GetText(row, col, 8)
   sMapDate = "20" & sMapDate
   If Mid(sMapDate,1,2) >= "70" Then
      sMapDate = "19" & sMapDate
   End If
End Function
'   画面の判定(開始画面)------------------------
Function IsFirstMap(BeginKey)
   Dim row:row = 1            '画面位置(行)
   Dim col:col = 2            '画面位置(列)
   IsFirstMap = False
   ' 文字列の存在有無と判定
   If emlECLPSObj.SearchText("V1210", 1, row, col) Then
      IsFirstMap = True
   End If
End Function
' 表示入力画面でDS指定して実行する ---------------
Function SetMap210JobnameGo(sJobName1)
   Dim row:row = 4            '画面位置(行)
   Dim col:col = 21           '画面位置(列)
   Dim row1:row1 = 3          '画面位置(行)
   Dim col1:col1 = 21         '画面位置(列)
   Dim sKBN
   SetMap210JobnameGo = False
   '更新区分が照会のみしか実行させない
   sKBN = emlECLPSObj.GetText(row,col,1)
   If sKBN = "S" Then
      sJobName = sJobName1 & "[enter]"
      emlECLPSObj.SendKeys sJobName, row1, col1
      SetMap210JobnameGo = True
      MsgBox " 更新区分が照会以外は不可" & sJobName1,vbCritical,sTitle & G_Ver
   End If
End Function
'   有効日付範囲の判定 ---------------------------
Function IsValidDate(sMapDate,sYYS,sYYE)
   Dim sYYYYS:sYYYYS = ""
   Dim sYYYYE:sYYYYE = ""
   IsValidDate = False
   '2桁表示の西暦を4桁表示に変換
   If sYYS <> "" Then
      sYYYYS = "20" & sYYS
      If Mid(sYYS,1,2) >= "70" Then
         sYYYYS = "19" & sYYS
      End If
   End If
   If sYYE <> "" Then
      sYYYYE = "20" & sYYE
      If Mid(sYYE,1,2) >= "70" Then
         sYYYYE = "19" & sYYE
      End If
   End If
   ' 有効範囲の判定
   If sMapDate >= sYYYYS And sMapDate <= sYYYYE Then
      '効力有効の時
      IsValidDate = True
   End If
End Function
' 指定時間、処理を待機する -----------------------
Function SetWaitTime(lmilliseconds)
   emlECLPSObj.Wait(lmilliseconds)
End Function
' 共通プロパティの取得  --------------------------
Function GetCommonMacroname
   GetCommonMacroname = ThisMacroName
End Function
Function GetCommonSessionName
   GetCommonSessionName = ThisSessionName
End Function
'
' ヘルスチェック  利用可能判定 ---------------------
Function IsEnableEnv(sTitle)
   Dim bStarted:bStarted = emlECLPSObj.Started             '
   Dim bCommStarted:bCommStarted = emlECLPSObj.CommStarted '
   Dim bAPIEnabled:bAPIEnabled = emlECLPSObj.APIEnabled    '
   Dim bReady:bReady = emlECLPSObj.Ready                   '
   '
   IsEnableEnv = False
   If (bStarted = True and _
       bCommStarted = True and _
       bAPIEnabled = True and _
       bReady = True) Then
       IsEnableEnv = True
   Else
       sMsg = " Started     :" & bStarted & vbCrlf & _
              " CommStarted :" & bCommStarted & vbCrlf & _
              " APIEnabled  :" & bAPIEnabled & vbCrlf & _
              " Ready       :" & bReady
       Msgbox sMsg,64,sTitle
   End If
End Function


2024年1月7日日曜日

MODT

 'TN3270ModTマン.mac
[TCPLINK SCRIPT HEADER]
DESCRIPTION=Module TimeStamp Information List(3270 Emulator)
[TCPLINK SCRIPT SOURCE]
'Option Explicit
   Dim emlECLPSObj
   Dim sThisSessionName, sThisMacroName
   Dim sMsg
   Dim Text, iDataPos
   Dim iCnt, wCnt, wCnt_MemNfd, wCnt_SerchFail
   Dim SPCCLEAR
   Dim sDsName, sDsName1
   Dim Row, Col, Rows, Cols, CurRow, CurCol
' 初期 -------------------------------------------
' 共通プロパティー値の設定
   sThisMacroName = Replace(GetCommonMacroname(),".mac","")
   sThisSessionName = GetCommonSessionName()
   Set emlECLPSObj = CreateObject("TESSC.emlECLPS")
   emlECLPSObj.SetConnectionByName(ThisSessionName)
   
   Dim sTitle:sTitle = sThisMacroName
   Dim iDebug:iDebug = 0
   Dim lmilliseconds:lmilliseconds = 3000:
   Dim lmilliseconds2: lmilliseconds2 = 1000
   Dim BeginKey:BeginKey = "表示入力パネル"
   Dim sLibNm:sLibNm = "xxxxxxxxxxxxxxx"
   Dim sMemNm:sMemNm = ""
   Dim sYYY:sYYY = "202"         '西暦年の上位3桁
   Dim IFileNm:IFileNm = sThisMacroName & "_I.txt"
   Dim OFileNm:OFileNm = sThisMacroName & "_O.CSV"
   
   iCnt= 0:wCnt= 0:wCnt_MemNfd = 0:wCnt_SerchFail= 0
   sDsName1 = sLibNm & "(" & sMemNm & ")"
' 主処理 -----------------------------------------
If IsEnabelEnv(sTitle) = False Then
   MsgBox " ヘルスチェック:利用不可です",64,sTitle
Else
   '処理開始画面の確認
   If IsFirstMap(BeginKey) Then
   
        ' * メンバー数分の繰返し開始 -------------
        Set fso = CreateObject("Scripting.FileSystemObject")
        If fso.FileEXISTS(IFileNm) = True Then
            Set file1 = fso.OpenTextFile(".\" & IFileNm)
            Set file2 = fso.OpenTextFile(".\" & OFileNm, 2,True)
            sMsg = " 入力File名:" & IFileNm & vbCrLf & _
                   " 対象LIB名 :" & sLibNm & vbCrLf & _
                   " 検索ワード:" & "Member+" & sYYY & vbCrLf & _
                   " 出力File名:" & OFileNm
            MyVar = MsgBox (sMsg, vbYesNo, sTitle)
            If MyVar = vbYES Then
               wCnt = 0
               Do Until file1.AtEndOfStream
                  sMemNm = file1.readline
                  iCnt = iCnt + 1
                  '■1.データセットとメンバーを指
                  ' SPCCLEAR = "                                      "
                  'クリヤー
                  'emlECLPSObj.SetText SPCCLEAR, 8,31
                  sDsName1 = sLibNm & "(" & sMemNm & ")"
                  SetBrowsMapDsnameGo(sDsName1)
                  SetWaitTime(lmilliseconds)     '待機する時間
                  If IsFirstMap(BeginKey) Then
                     '■5.画面「表示入力パネル」から遷移しない
                     file2.WriteLine(sLibNm & "," & sMemNm)
                     wCnt_MemNfd = wCnt_MemNfd + 1
                  Else
                     '■2.画面「表示入力パネル」から遷移
                     '表示したモジュールからタイムスタンプ取得しファイル出力
                     ' ①.文字列検索で検索値をセットして実行する
                     FindChars("F " & sMemNm & sYYY)
                     '検索値へカーソル移動
                     Enter
                     SetWaitTime(lmilliseconds)     '待機する時間
                     ' ②.文字列検索した行をファイル出力する
                     '画面の行数列数を取得
                     Rows = emlECLPSObj.NumRows:Cols = emlECLPSObj.NumCols
                     '  検索結果の行・列番号を取得
                     CurRow = emlECLPSObj.CursorPosRow:CurCol = emlECLPSObj.CursorPosCol
                     '  画面の取得開始位置を指定
                     iDataPos = CurCol + len(sMemNm)
                     '  検索値の取得
                     Text = emlECLPSObj.GetText(CurRow,iDataPos,20)
                     '■3.検索結果を含めて、テキストファイルへ書き出す
                     If CurRow > 4 Then
                         ' ①検索成功の場合
                         file2.WriteLine(sLibNm & "," & sMemNm & "," & "#" & Text)
                         wCnt = wCnt + 1
                      Else
                         ' ②検索失敗の場合
                         file2.WriteLine(sLibNm & "," & sMemNm)
                         wCnt_SerchFail = wCnt_SerchFail + 1
                      End If
                      If iDebug = 1 Then
                         sMsg= "入力File名:" & IFileNm & vbCrLf & _
                                 "【処理結果】 " & vbCrLf & _
                                 "DSNAME    : " & sLibNm & "(" & sMemNm & ")" & vbCrLf & _
                                 "画面行列数:(" & Rows & ":" & Cols & ")" & vbCrLf & _
                                 "検索ワード: " & "F " & sMemNm & sYYY & vbCrLf & _
                                 "Cur行列   :(" & CurRow & ":" & CurCol & ")" & vbCrLf & _
                                 "Get開始列 : " & iDataPos & vbCrLf & _
                                 "GetTEXT   : " & Text & vbCrLf & _
                                 "出力File名: " & OFileNm
                         MyVar =MsgBox (sMsg,,sTitle & G_Ver)
                      End If
                      SetWaitTime(lmilliseconds2)     '待機する時間
                      '
                      '■4.
                      PF3    '前画面(画面「表示入カパネル」)に戻る
                  End If
               Loop
               ' 終了 ---------------------------
               filel.Close
               file2.Close
               Set fso = Nothing
               sMsg = " 処理終了 " & vbCrlf & _
                      " 入力ファイル " & IFileNm & vbCrlf & _
                      " 件数            :" & iCnt & VbCrlf & _
                      " 出カファイル    :" & OFileNm & vbCrlf & _
                      " 件数(正常)    :" & wCnt & vbCrlf & _ 
                      " 件数(メンバ否):" & wCnt_MemNfd & vbCrlf & _
                      " 件数(検索否)  :" & wCnt_SerchFail
               MsgBox sMsg,vbInformation, sTitle
            Else
               MsgBox " 処理を中止しました。",vbExclamation,sTitle
            End If
        Else
           MsgBox " 入力ファイルが存在しません。" & IFileNm,vbCritical,sTitle 
        End If
   Else
      MsgBox " 開始画面は「表示入力パネル」です。",vbCritical,sTitle
   End If
End If
'**************************************************
'* 開数
'**************************************************
' 指定時間、処理を待機する -----------------------
Function SetWaitTime(lmilliseconds)
   emlECLPSObj.Wait(lmilliseconds)
End Function
' 入力DS名の表示結果画面の判定 -------------------
Function IsDsFound(Key)
   Dim row:row = 1             '画面位置(行)
   Dim col:col = 11            '画面位置(列)
   IsDsFound = False
   ' 文字列の存在確認と判定
   If emlECLPSObj.SearchText(Key, 1, row, col) Then
      IsDsFound = True
   End If
End Function
' 開始画面の判定 ---------------------------------
Function IsFirstMap(BeginKey)
   Dim row:row = 1             '画面位置(行)
   Dim col:col = 34            '画面位置(列)
   IsFirstMap = False
   ' 文字列の存在確認と判定
   If emlECLPSObj.SearchText(BeginKey,1,row, col) Then
      IsFirstMap = True
   End If
End Function
' 文字列の検索 -----------------------------------
Function FindChars(FindKey)
   Dim row:row = 2             '画面位置(行)
   Dim col:col = 18            '画面位置(列)
   Dim sFindKey
   sFindKey = FindKey & "[enter]"
   emlECLPSObj.SendKeys sFindKey, row, col
End Function
' 表示入力画面でDS指定して実行する ---------------
Function SetBrowsMapDsnameGo(sDsName1)
   Dim row:row = 11            '画面位置(行)
   Dim col:col = 20            '画面位置(列)
   Dim sDsName
   sDsName = sDsName1 & "[enter]"
   emlECLPSObj.SendKeys sDsName, row, col
End Function
' 空エンター -------------------------------------
Function Enter()
   emlECLPSObj.SendKeys "[enter]"
End Function
' PF3で戻る --------------------------------------
Function PF3()
   emlECLPSObj.SendKeys "[PF3]"
End Function
' 共通プロパティの取得  --------------------------
Function GetCommonMacroname
   GetCommonMacroname = ThisMacroName
End Function
Function GetCommonSessionName
   GetCommonSessionName = ThisSessionName
End Function
' -----------------------------------------------------
' ヘルスチェック  利用可能判定
' -----------------------------------------------------
Function IsEnableEnv(sTitle)
   Dim bStarted:bStarted = emlECLPSObj.Started             '
   Dim bCommStarted:bCommStarted = emlECLPSObj.CommStarted '
   Dim bAPIEnabled:bAPIEnabled = emlECLPSObj.APIEnabled    '
   Dim bReady:bReady = emlECLPSObj.Ready                   '
   '
   IsEnableEnv = False
   If (bStarted = True and _
       bCommStarted = True and _
       bAPIEnabled = True and _
       bReady = True) then
       IsEnableEnv = True
   Else
       sMsg = " Started     :" & bStarted & vbCrlf & _
              " CommStarted :" & bCommStarted & vbCrlf & _
              " APIEnabled  :" & bAPIEnabled & vbCrlf & _
              " Ready       :" & bReady
       Msgbox sMsg,64,sTitle
   End If
End Function
' 画面サイズの取得 -------------------------------
Function GetMapSize
' -表示スペース内での行数,桁数を取得-
   Dim row:row = emlECLPSObj.NumRows  '画面位置(行)
   Dim col:col = emlECLPSObj.NumCols  '画面位置(列)
   sMsg = " 表示スペース:" & _
          row & " 行 " & col & " 列 "
   'MsgBox sMsg,, 64, sTitle
End Function
' 接続情報の取得 ---------------------------------
Function ConnectInfo
   Dim sNameCommStarted, lHandle, sConnType
   '接続に関する情報
   sName = emlECLPSObj.Name
   lHandle = emlECLPSObj.Handle
   sConnType = emlECLPSObj.ConnType
   sMsg = " 接続情報 Name:" & sName & _
          " lHandle      :" & lHandle & _
          " sConnType    :" & sConnType
   'MsgBox sMsg,, 64, sTitle
End Function
' コードページの取得 -----------------------------
Function GetCodePage
   Dim ICodePage, sMsgCode
   ' コードページ
   ICodePage = emlECLPSObj.CodePage
   sMsgCode = "CodePage   :" & ICodePage
   GetCodePage = sMsgCode
End Function
' カーソル位置の取得 -----------------------------
Function CurPos
   '-カーソル位置の行数,桁数を取得-
   Dim row:row = emlECLPSObj.CursorPosRow  '画面位置(行)
   Dim col:col = emlECLPSObj.CursorPosCol  '画面位置(列)
   sMsg = " カーソル位置:" & _
          row & " 行 " & col & " 列 "
   MsgBox sMsg,, 64, sTitle
End Function

2024年1月6日土曜日

稼働実績

[TCPLINK SCRIPT HEADER]
DESCRIPTION=Job Run TimeStamp Information List(3270 Emulator)
[TCPLINK SCRIPT SOURCE]
'Option Explicit
' *************************************************************
' 機能:指定したJOBの実行日時を取得する
' 入力:マクロ名+_I.txt メンバ名を行列記する
' 出力:マクロ名+_0.CSV LIB名、メンバ名、タイムスタンプ
' 変更履歴
'   2023.06.29 入力テキストに空行がある時は、処理対象としない
' *************************************************************
   Dim emlECLPSObj
   Dim sThisSessionName, sThisMacroName
   Dim sMsg
   Dim sDsName
   Dim Row, Col, Rows, Cols, CurRow, CurCol
   Dim iDataPos
   Dim Text
' 初期 -------------------------------------------
   Dim G_Ver:G_Ver = " 1.0 "
   Dim iDebug:iDebug = 0
   Dim lmilliseconds: lmilliseconds = 3000
   Dim lmilliseconds2:lmilliseconds2 = 1000
   Dim BeginKey:BeginKey = "表示入力パネル"   
' 共通プロパティー値の設定 -----------------------
   sThisMacroName = Replace(GetCommonMacroname(),".mac","")
   sThisSessionName = GetCommonSessionName()
   Set emlECLPSObj = CreateObject("TESSC.emlECLPS")
   emlECLPSObj.SetConnectionByName(sThisSessionName)
   Dim sTitle:sTitle = sThisMacroName
   Dim IFileNm:IFileNm = sThisMacroName & "_I.txt"
   Dim OFileNm:OFileNm = sThisMacroName & "_O.CSV"
   
   Dim sMemNm:sMemNm = ""
   Dim sLibNm:sLibNm = "ZLOGF\1"
   sDsName = sLibNm & "(" & sMemNm & ")"
   Dim iCnt, wCnt, wCnt_MemNfd, wCnt_SerchFail
   iCnt=0:wCnt=0:wCnt_MemNfd =0:wCnt_SerchFail=0

'  主処理 ----------------------------------------
If IsEnableEnv(sTitle) = False Then
   MsgBox " ヘルスチェック:利用不可です",64,sTitle
Else
   '処理開始画面の確認
   If IsFirstMap(BeginKey) Then
      '*メンバー数分の繰返し開始
      Set fso = CreateObject("Scripting.FileSystemObject")

      If fso.FileEXISTS(IFileNm) = True Then

         Set file1 = fso.OpenTextFile(".\" & IFileNm)
         Set file2 = fso.OpenTextFile(".\" & OFileNm, 2, True)

         sMsg = " 入力File名:" & IFileNm & vbCrLf & _
                " 対象LIB名 :" & sLibNm & vbCrLf & _
                " 検索ワード:" & "Member" & vbCrLf & _
                " 出力File名:" & OFileNm
         MyVar = MsgBox (sMsg, vbYesNo, sTitle & G_Ver)
         If MyVar = vbYES Then
            wCnt = 0
            Do Until file1.AtEndOfStream
               sMemNm = file1.readline
               iCnt = iCnt + 1
               '■1.データセットとメンバーを指定
               If sMemNm <> "" Then
                  sDsName = sLibNm & "(" & sMemNm & ")"
                  SetBrowsMapDsnameGo(sDsName)

                  SetWaitTime(lmilliseconds)         '待機する時間

                  If IsFirstMap(BeginKey) Then
                     '■5.画面「表示入力パネル」 'メンバー無しの時
                     file2.WriteLine(sLibNm & "," & sMemNm)
                     wCnt_MemNfd = wCnt_MemNfd + 1
                  Else
                     '■2.画面「表示入力パネル」から遷移
                      '表示したモジュールからタイムスタンプ取得しファイル出力

                     '①.文字列検索で検索値をセットして実行する
                     FindChars("F " & sMemNm)
                     '検索値へカーソル移動
                     Enter

                     SetWaitTime(lmilliseconds)          '待機する時間

                     '②.文字列検索した行をファイル出力する
                     Rows = emlECLPSObj.NumRows:Cols= emlECLPSObj.NumCols                 '画面の行数列数を取得
                     CurRow = emlECLPSObj.CursorPosRow:CurCol = emlECLPSObj.CursorPosCol  '検索結果の行列番号を取得
                     iDataPos = CurCol                   ' 画面の取得開始位置を指定
                     ' 検索値の取得
                     Dim Text1, Text2, Text3, Text4
                     Text1 = emlECLPSObj.GetText(CurRow,iDataPos,8)
                     Text2 = emlECLPSObj.GetText(CurRow,iDataPos+11,8)
                     Text3 = emlECLPSObj.GetText(CurRow,iDataPos+23,8)
                     Text4 = emlECLPSObj.GetText(CurRow,iDataPos+35,8)

                     'Msgbox " Text1=" & Text1 & _
                     '       " Text2=" & Text2 & _
                     '       " Text3=" & Text3 & _
                     '       " Text4=" & Text4

                     '■3.検索結果を含めて、テキストファイルへ書き出す
                     If CurRow > 4 then
                        ' ①1検索成功の場合
                        file2.WriteLine(sLibNm &"," & sMemNm & "," & _
                              "#" & Text1 & "," & "#" & Text2 & "," & _
                              "#" & Text3 & "," & "#" & Text4)
                        wCnt = wCnt + 1
                     Else
                        ' ②2検索失敗の場合
                        file2.WriteLine(sLibNm & "," & sMemNm)
                        wCnt_SerchFail = wCnt_SerchFail + 1
                     End If

                     If iDebug = 1 Then
                        sMsg = " 入力File名 :  " & IFileNm & vbCrLf & _
                               "【処理結果】    " & vbCrLf  & _
                               " DSNAME     :  " & sLibNm  & "(" & sMemNm & ")" & vbCrLf & _
                               " 画面行列数 :(" & Rows    & ":" & Cols & ")" & vbCrLf & _
                               " 検索ワード :  " & "F "    & sMemNm & vbCrLf & _
                               " Cur行列    :(" & CurRow  & ":" & CurCol & ")" & vbCrLf & _
                               " Get開始列  :  " & iDataPos & vbCrLf & _
                               " GetTEXT    :  " & Text & vbCrLf & _
                               "出力File名  :  " & OFileNm
                        MyVar = MsgBox (sMsg,,sTitle & G_Ver)
                     End If

                     SetWaitTime(lmilliseconds2)         '待機する時間

                     '■4.'前画面(画面「表示入カパネル」)に戻る
                     PF3
                  End If
               End If
            Loop
            ' 終了 -----------------------------------
            file1.Close:file2.Close
            Set fso = Nothing
            sMsg = " 処理終了          " & vbCrlf & _
                   " 入力ファイル      " & IFileNm & vbCrlf & _
                   " 件数            :" & iCnt & VbCrlf & _
                   " 出カファイル    :" & OFileNm & vbCrlf & _
                   " 件数(正常)    :" & wCnt & vbCrlf & _ 
                   " 件数(メンバ否):" & wCnt_MemNfd & vbCrlf & _
                   " 件数(検索否)  :" & wCnt_SerchFail
            MsgBox sMsg, vbInformation, sTitle & G_Ver
         Else
            MsgBox " 処理続行に「いいえ」と応答 ",vbCritical,sTitle & G_Ver
         End If
      Else
         MsgBox " 入力テキストファイルが存在しません " & IFileNm,vbCritical,sTitle & G_Ver
      End If
   Else
      MsgBox " 開始画面は「表示入力パネル」です。" ,vbCritical,sTitle & G_Ver
   End If
End If

' ************************************************
'  関数
' ************************************************
' ------------------------------------------------
'   画面の判定(開始画面)
' ------------------------------------------------
Function IsFirstMap(BeginKey)
   Dim row:row = 1             '画面位置(行)
   Dim col:col = 34            '画面位置(列)
   IsFirstMap = False
   ' 文字列の存在有無と判定
   If emlECLPSObj.SearchText(BeginKey, 1, row, col) Then
      IsFirstMap = True
   End If
End Function
' 入力DS名の表示結果画面の判定 -------------------
Function IsDsFound(Key)
   Dim row:row = 1             '画面位置(行)
   Dim col:col = 11            '画面位置(列)
   IsDsFound = False
   ' 文字列の存在確認と判定
   If emlECLPSObj.SearchText(Key, 1, row, col) Then
      IsDsFound = True
   End If
End Function

' 表示入力画面でDS指定して実行する ---------------
Function SetBrowsMapDsnameGo(sDsName)
   Dim row:row = 11            '画面位置(行)
   Dim col:col = 20            '画面位置(列)
   Dim sDsName1
   sDsName1 = sDsName & "[enter]"
   emlECLPSObj.SendKeys sDsName1, row, col
End Function

' 文字列の検索 -----------------------------------
Function FindChars(FindKey)
   Dim row:row = 2             '画面位置(行)
   Dim col:col = 18            '画面位置(列)
   Dim sFindKey
   sFindKey = FindKey & "[enter]"
   emlECLPSObj.SendKeys sFindKey, row, col
End Function

' 指定時間、処理を待機する -----------------------
Function SetWaitTime(lmilliseconds)
   emlECLPSObj.Wait(lmilliseconds)
End Function
' 共通プロパティの取得  --------------------------
Function GetCommonMacroname
   GetCommonMacroname = ThisMacroName
End Function
Function GetCommonSessionName
   GetCommonSessionName = ThisSessionName
End Function

' 空エンター -------------------------------------
Function Enter()
   emlECLPSObj.SendKeys "[enter]"
End Function

' PF3で戻る --------------------------------------
Function PF3()
   emlECLPSObj.SendKeys "[PF3]"
End Function

' カーソル位置の取得 -----------------------------
Function CurPos
   '-カーソル位置の行数,桁数を取得-
   Dim lCursorPosRow, lCursorPosCol
   lCursorPosRow = emlECLPSObj.CursorPosRow
   lCursorPosCol = emlECLPSObj.CursorPosCol
   sMsg = "カーソル位置:" & _
   LCursorPosRow & " 行 " &ICursorPosCol & " 列 "
   MsgBox sMsg,, 64, sTitle
End Function

' 画面サイズの取得 -------------------------------
Function GetMapSize
   ' -表示スペース内での行数,桁数を取得-
   Dim lNumRows, lNumCols
   lNumRows = emlECLPSObj.NumRows
   lNumCols = emlECLPSObj.NumCols
   sMsg = "表示スペース:" & _
   INumRows & " 行 " & lNumCols & " 列 "
   'MsgBox sMsg,, 64, sTitle
End Function

' 接続情報の取得 ---------------------------------
Function ConnectInfo
   Dim sNameCommStarted, lHandle, sConnType
   '  接続に関する情報
   sName = emlECLPSObj.Name
   lHandle = emlECLPSObj.Handle
   sConnType = emlECLPSObj.ConnType
   sMsg = "接続情報 Name:" & sName & _
          "lHandle      : " & lHandle & _
          "sConnType    : " & sConnType
   'MsgBox sMsg,, 64, sTitle
End Function
' コードページの取得 ------------------------------
Function GetCodePage
   Dim ICodePage, sMsgCode
   ' コードページ
   ICodePage = emlECLPSObj.CodePage
   sMsgCode = "CodePage   :" & ICodePage
   GetCodePage = sMsgCode
End Function
'
' -------------------------------------------------
' ヘルスチェック  利用可能判定
' -------------------------------------------------
Function IsEnableEnv(sTitle)
   Dim bStarted:bStarted = emlECLPSObj.Started             '
   Dim bCommStarted:bCommStarted = emlECLPSObj.CommStarted '
   Dim bAPIEnabled:bAPIEnabled = emlECLPSObj.APIEnabled    '
   Dim bReady:bReady = emlECLPSObj.Ready                   '
   '
   IsEnableEnv = False
   If (bStarted = True and _
       bCommStarted = True and _
       bAPIEnabled = True and _
       bReady = True) Then
       IsEnableEnv = True
   Else
       sMsg = " Started     :" & bStarted & vbCrlf & _
              " CommStarted :" & bCommStarted & vbCrlf & _
              " APIEnabled  :" & bAPIEnabled & vbCrlf & _
              " Ready       :" & bReady
       Msgbox sMsg,64,sTitle
   End If
End Function

DS

'拡張データセットー覧マン_開発.mac

[TCPLINK SCRIPT HEADER]
DESCRIPTION=DataSet List Information(3270 Emulator)
[TCPLINK SCRIPT SOURCE]
'Option Explicit

   Dim emlECLPSObj
   Dim sThisSessionName, sThisMacroName
   Dim sMsg, sTitle
   Dim lmilliseconds1, lmilliseconds2
   Dim Row, Col
   Dim sDsName, sDsName1, sDsName2
   Dim lMaxDSNs
   Dim LenToGet
   Dim lPageCnt
   Dim OfileName
   Dim DsName
   Dim wCnt
   Dim MyVar
   Dim iVOLCnt1, iSPCCnt1, iATTCnt1
' 初期 -------------------------------------------
   sDsName1 = "xxxxxxxxxxxxxxxx .*"
   lmilliseconds1 = 3000:lmilliseconds2 = 1000

' 共通プロパティー値の設定
   sThisMacroName = GetCommonMacroname()
   sThisSessionName = GetCommonSessionName()
   sTitle = sThisMacroName
   Set emlECLPSObj = CreateObject("TESSC.emlECLPS")
   emlECLPSObj.SetConnectionByName(sThisSessionName)

' 主処理 -----------------------------------------
If IsEnabelEnv(sTitle) = False Then
   MsgBox "ヘルスチェック:利用不可です",64,sTitle
Else
   ' ファイルの存在確認して存在していれば削除する
   FileDel(sThisMacroName)

   ' 処理開始画面の確認
   If IsFirstMap34 Then

     '************************
     '*** データセット1(H) ***
     '************************
     ' * ■VOL情報
     MyVar = VOL_Main_Ready(sDsName1,1)
     If MyVar = True Then
        iVOLCnt1 = VOL_Main(sDsName1)
     End If
     SetReturnKey
     '--- 待機する時間 ---
     SetWaitTime(lmilliseconds1)

     ' * ■SPACE情報
     MyVar = SPC_Main_Ready(sDsName1,0)
     If MyVar = True Then
        iSPCCntl = SPC_Main(sDsName1)
     End If
     SetReturnKey
     '--- 特機する時間---
     SetWaitTime(Imillisecondsl)

     ' * ■属性情報
     MyVar = ATT_Main_Ready(sDsName1,0)
     If MyVar = True Then
        iATTCnt1 = ATT_Main(sDsName1)
     End If
     SetReturnKey
     '--- 待機する時間 ---
     SetWaitTime(lmilliseconds1)

     ' ------------------------------------
     sMsg = "処理終了しました:" & vbCrLf & " " & vbCrLf & _
            "対象    :" & sDsName1 & vbCrLf & _
            "  出力  :" & sThisMacroName & "_1" & ".txt" & _
            "    件数:" & iVOLCnt1 &" | " & iSPCCnt1

      MsgBox sMsg, 64, sTitle
   Else
      MsgBox "処理開始の画面が違います",vbCritical,sTitle
   End If
End If

'*************************************************
'* 関数
'*************************************************
' ************************************************
' * ■VOL情報
' ************************************************
Function VOL_Main_Ready(sDsName, iMsgON)
   Dim MyVar
   Main Ready = False

   '■1.データセットを選択して実行
   SetMap340ption1
   SetMap34DsnameAndGo(sDsName)

   SetWaitTime(lmilliseconds1)
   If IsDsNotFndChar(sDsName) = True Then
      VOL_Main_Ready = False
      Exit Function
   End If

   '待機する時間
   SetWaitTime(lmilliseconds1)

   ' ■2.データセットのメンバーー覧から総ページ数を求める
   '最大データセット数の取得
   lMaxDSNs = GetMaxDSNs

   ' ページ数の計算
   lPageCnt = 01
   lPageCnt = GetMaxPageVOL(lMaxDSNs)
   If iMsgON = 1 Then
       sMsg= " 処理を開始しますか:" & vbCrLf & "" & vbCrLf & _
             " 情報抽出元:" & sDsName & vbCrLf & _
             " メンバー数:" & MaxDSNs & "ページ数:" & IPageCnt & vbCrlf & _
             " 出力      :" & sThisMacroName & "_1" & ".txt"

       MyVar = MsgBox (sMsg, vbYesNo,sTitle)
       If MyVar = vbNo Then
          MsgBox " 処理を中止しました。",vbExclamation,sTitle
          Exit Function
       End If
   End If
   VOL_Main_Ready = True
End Function
'
' データセットのボリューム情報を画面スクロールしながら取得する
Function VOL_Main(sDsName)

   Dim rowMIN:rowMIN = 6
   Dim rowMAX:rowMAX = 24
   Dim wCnt
   Dim LVOL, RVOL

   '■3.データセットのメンバーー覧をスクロールしながら面面を
   '出力したファイルへ書き出す。
   Set fso = CreateObject("Scripting.FileSystemObject")
   Ofilename = sThisMacroName & "_1" & ".txt"
   Set file = fso.OpenTextFile(".\" & Ofilename, 8, True)

   wCnt = 0
   For a = 1 to lPageCnt
       '画面の行範囲
       For b = rowMIN to rowMAX
          'データセットの取得
          DsName = GetDsnLstName(b)
          If not DsName = "" Then
             VOL = Trim(GetVolumeName(b))
             
             LVOL = Trim(Mid(VOL,1,6))
             RVOL = Trim(Mid(VOL,7,1))
             '
             If IsEndLineWord(b) = False Then
                 wCnt = wCnt + 1
                 file.WriteLine(DsName & "," & LVOL & "," & RVOL)
             Else
                 exit For
             End If
          End If
       Next
          
       ' 終了文字列の存在確認と判定
       If IsEndWord Then
           Exit For
       End If
       ' 次ページヘスクロールする
       NextPageScroll
       '0IA メッセージ確認 SetOIAWaitTime 待機する時間
       SetWaitTime(lmilliseconds2)
   Next

   file.Close
   Set fso = Nothing
   VOL_Main = wCnt
End Function

' ************************************************
' * ■SPACE情報
' ************************************************
Function SPC_Main_Ready(sDsName, iMsgON)
   Dim MyVar
   SPC_Main_Ready = False

  '■1.データセットを選択して実行
   SetMap340ption2
   SetMap34DsnameAndGo(sDsName)
   If IsDsNotFndChar(sDsName) = True Then
      SPC_Main_Ready = False
      Exit Function
   End If
   '待機する時間
   SetWaitTime(lmilliseconds1)

   '■2.データセットのメンバーー覧から総ページ数を求める

   '最大データセット数の取得
   lMaxDSNs = GetMaxDSNs
   'ページ数の計算
   lPageCnt = 01
   lPageCnt = GetMaxPageSPC(lMaxDSNs)
   If iMsgON = 1 Then
      sMsg = " 処理を開始しますか:" & vbCrLf & "" & vbCrLf & _
             " 情報抽出元:" & sDsName & vbCrLf & _
             " メンバー数:" & LMaxDSNs & " ページ数:" & lPageCnt & vbCrlf & _
             " 出力      :" & sThisMacroName & "_2" & ".txt"

      MyVar = MsgBox (sMsg, vbYesNo,sTitle)
      If MyVar = vbNo Then
         MsgBox "処理を中止しました。",vbExclamation,sTitle
         Exit Function
      End If
   End If
   SPC_Main_Ready = True
End Function

' データセットのスペース情報を画面スクロールしながら取得する
Function SPC_Main(sDsName)

   Dim rowMIN:rowMIN = 6
   Dim rowMAX:rowMAX = 24
   Dim SPCX: SPCX = ""
   Dim wCnt

   '■3.データセットのメンバーー覧をスクロールしながら面面を
   '出力したファイルへ書き出す。
   Set fso =CreateObject("Scripting.FileSystemObject")
   Ofilename = sThisMacroName & "_2" & ".txt"
   Set file = fso.OpenTextFile(".\" & Ofilename, 8, True)

   wCnt = 0
   For a = 1 to lPageCnt
      '画面の行範囲
       For b = rowMIN to rowMAX
          'データセットの取得
          DsName = GetDsnLstName(b)
          If Not DsName = "" Then
             'SPACE
             SPCX = GetSPACE(b)
             While InStr(SPCX, "  ")
                   SPCX = Replace(SPCX, "  ", " ")
             Wend
             ' 空白区切りで配列保持
             arr = Split(SPCX, " ")
             SPCX = Join(arr, ",")
             If IsEndLineWord(b) = False Then
                 wCnt = wCnt + 1
                 file.WriteLine (DsName & "," & SPCX)
             Else
                Exit For
             End If
          End If
       Next
          
       ' 終了文字列の存在確認と判定
       If IsEndWord Then
          Exit For
       End If
       ' 次ページヘスクロールする
       NextPageScroll
       '0IA メッセージ確認 SetOIAWaitTime 待機する時間
       SetWaitTime(lmilliseconds2)
   Next

   file.Close
   Set fso = Nothing
   SPC_Main = wCnt
End Function
'
' ************************************************
' * ■属性情報
' ************************************************
Function ATT_Main_Ready(sDsName, iMsgON)

   Dim MyVar
   ATT_Main_Ready = False

   '■1.データセットを選択して実行
   SetMap340ption3
   SetMap34DsnameAndGo(sDsName)

   If IsDsNotFndChar(sDsName) = True Then
      ATT_Main_Ready = False
      Exit Function
   End If

   ' 待機する時間
   SetWaitTime(lmilliseconds1)

   ' ■2.データセットのメンバーー覧から総ページ数を求める

   ' 最大データセット数の取得
   lMaxDSNs = GetMaxDSNs

   ' ページ数の計算
   lPageCnt = 01
   lPageCnt = GetMaxPageSPC(lMaxDSNs)

   If iMsgON = 1 Then
      sMsg = "処理を開始しますか:" & vbCrLf & "" & vbCrLf & _
      "情報抽出元:" & sDsName & vbCrLf & _
      "メンバー数:" & IMaxDSNs & " ページ数:" & lPageCnt & _
      "出力      :" & sThisMacroName & "_3" & ".txt"

      MyVar = MsgBox (sMsg, vbYesNo,sTitle)
      If MyVar = vbNo Then
         MsgBox "処理を中止しました。",vbExclamation,sTitle
         Exit Function
      End If
   End If
   ATT_Main_Ready = True
End Function

’データセットの属性情報を画面スクロールしながら取得する
Function ATT_Main(sDsName)

   Dim rowMIN:rowMIN = 6
   Dim rowMAX:rowMAX = 24
   Dim wCnt

   '■3.データセットのメンバーー覧をスクロールしながら画面を
   ' 出力したファイルへ書き出す。
   Set fso = CreateObject("Scripting.FileSystemObject")
   Ofilename = sThisMacroName & "_3" & ".txt"
   Set file = fso.OpenTextFile(".\" & Ofilename, 8, True)

   wCnt = 0
   For a = 1 to lPageCnt
       '画面の行範囲
       For b = rowMIN to rowMAX
          'データセットの取得
          DsName =Trim(GetDsnLstName(b))
          If not DsName = "" Then
             'SPACE
             ATT = GetATTR(b)
             '2文字以上の空白を空白1文字にする
             While InStr(ATT, "  ")
                   ATT = Replace(ATT, "  "," ")
             Wend

             '空白区切りで配列保存
             arr=Split(ATT," ")
             ATT = Join(arr, ",")
             If IsEndLineWord(b) = False Then
                 wCnt = wCnt + 1
                 file.WriteLine(DsName & "," & ATT )
             Else
                 exit For
             End If
          End If
       Next

      '終了文字列の存在確認と判定
       If IsEndWord Then
           Exit For
       End If

      '次ページヘスクロールする
       NextPageScroll

       '0IA メッセージ確認 SetOIAWaitTime 待機する時間
       SetWaitTime(Imilliseconds2)
   Next

   file.Close
   Set fso = Nothing
   ATT_Main = wCnt
End Function

'*************************************************
'* 関数2
'*************************************************
'
'テキストファイルの存在確認をして削除する
Function FileDel(sThisMacroName)
   Dim file
   FileDel = False
   ' ファイルの存在確認して存在していれば削除する
   Set fso = CreateObject("Scripting.FileSystemObject")

   file = sThisMacroName & "_1" & ".txt"
   ' ファイルの削除
   If(fso.FileExists(file))Then
     fso.DeleteFile file
   End If
   file = sThisMacroName & "_2" & ".txt"
   ' ファイルの削除
   If(fso.FileExists(file))Then
     fso.DeleteFile file
   End If
   file = sThisMacroName & "_3" & ".txt"
   ' ファイルの削除
   If(fso.FileExists(file))Then
     fso.DeleteFile file
   End If
   Set fso = Nothing
   FileDel = True
End Function

' ページ数の取得(VOL) ----------------------------
Function GetMaxPageVOL(lMaxDSNs)
   'ページ数の取得
   Dim lPageCnt:lPageCnt = 01
   Dim lLinebyPage:lLinebyPage = 19
   lMaxDSNs = Int(lMaxDSNs)
   lPageCnt = Int(lMaxDSNs / lLinebyPage + 0.5) + 1
   GetMaxPageVOL = lPageCnt
End Function

' ページ数の取得(SPC) ----------------------------
Function GetMaxPageSPC(lMaxDSNs)
   'ページ数の取得
   Dim lPageCnt:lPageCnt = 01
   Dim lLinebyPage:lLinebyPage = 17
   lMaxDSNs = Int(lMaxDSNs)
   lPageCnt = Int(lMaxDSNs / lLinebyPage + 0.5) + 1
   GetMaxPageSPC = lPageCnt
End Function

' 次ページを表示 -------------------------------
Function NextPageScroll()
   emlECLPSObj.SendKeys "[pf8]"
End Function

' 指定時間、処理を待機する -----------------------
Function SetWaitTime(lmilliseconds1)
   emlECLPSObj.Wait(lmilliseconds1)
End Function

' 最大データセット数の取得 -----------------------
Function GetMaxDSNs
   Dim row:row = 1             '画面位置(行)
   Dim col:col = 75            '画面位置(列)
   Dim LenToGet:LenToGet = 4
   GetMaxDSNs = emlECLPSObj.GetText(row, col,LenToGet)

   ' 不要な文字を除去する
   '[/] がある時は、それ以降のスペースを除いた文字にして、数値チェック

   GetMaxDSNs = Trim(GetMaxDSNs)
   If instr(1,GetMaxDSNs,"/") > 0 Then
      GetMaxDSNs=Trim(mid(GetMaxDSNs,2))
   End If
   '数値判定
   'If IsNumeric(GetMaxDSNs) = False Then
       MsgBox "数値ではありません",64,sTitle
   'End If
End Function

' データセットの存在確認判定 ---------------------
Function IsDsNotFndChar(sDsName)
   Dim row:row = 1             '画面位置(行)
   Dim col:col = 57            '画面位置(列)
   Dim LenToGet:LenToGet = 22
   Dim StatusChar
   IsDsNotFndChar = False
   '文字列の存在確認と判定
   StatusChar = Trim(emlECLPSObj.GetText(row, col,LenToGet))
   If StatusChar="データセット名がない" Then
      MsgBox sDsName & "_" & " データセット名がない ",vbExclamation,sTitle
      IsDsNotFndChar = True
   End If
End Function

' 開始画面の判定 ---------------------------------
Function IsFirstMap34
   Dim row:row = 1             '画面位置(行)
   Dim col:col = 21            '画面位置(列)
   Dim sBgnKey:sBgnKey= "データ・セット・リスト・ユー"
   IsFirstMap34 = False
   '文字列の存在確認と判定
   If emlECLPSObj.SearchText(sBgnKey, 1, row, col) Then
      IsFirstMap34 = True
   End If
End Function

' オプション設定 ---------------------------------
Function SetMap340ption1
   Dim row:row = 13            '画面位置(行)
   Dim col:col = 5             '画面位置(列)
   Dim sOotion:sOption = 1
   emlECLPSObj.SetText "1", row, col
End Function

' オプション設定 ---------------------------------
Function SetMap340ption2
   Dim row:row = 13            '画面位置(行)
   Dim col:col = 5             '画面位置(列)
   Dim sOotion:sOption = 2
   emlECLPSObj.SetText "2", row, col
End Function

' オプション設定 --------------------------------
Function SetMap340ption3
   Dim row:row = 13            '画面位置(行)
   Dim col:col = 5             '画面位置(列)
   Dim sOotion:sOption = 3
   emlECLPSObj.SetText "3", row, col
End Function

' データセットを指定して実行する -----------------
Function SetMap34DsnameAndGo(sDsName)
   Dim row:row = 8             '画面位置(行)
   Dim col:col = 31            '画面位置(列)
   Dim SPCCLEAR:SPCCLEAR = "                                      "
   ' クリヤー
   emlECLPSObj.SetText SPCCLEAR, row, col
   sDsName = sDsName & "[enter]"
   emlECLPSObj.SendKeys sDsName, row, col
End Function

' 戻る -------------------------------------------
Function SetReturnKey
   Dim row:row = 8             '画面位置(行)
   Dim col:col = 31            '画面位置(列)
   Dim sReturnKey:sReturnKey = "[PF3]"
   emlECLPSObj.SendKeys sReturnKey, row, col
End Function

' 終了文字の判定 -------------------------------
Function IsEndWord
   Dim row:row = 4             '画面位置(行)
   Dim col:col = 2             '画面位置(列)
   Dim EndWord:EndWord = "終り"
   IsEndWord = False
   ' 文字列の存在確認と判定
   If emlECLPSObj.SearchText(EndWord,1,row, col) Then
      IsEndWord = True
   End If
End Function

' 終了文字の行判定 -------------------------------
Function IsEndLineWord(b)
   Dim row:row = b             '画面位置(行)
   Dim col:col = 2             '画面位置(列)
   Dim LenToGet:LenToGet = 8
   IsEndLineWord = False
   ' 文字列の存在確認と判定
   If emlECLPSObj.GetText(row, col,LenToGet) = " ********" Then
     IsEndLineWord = True
   End If
End Function

' データセット名の取得 ---------------------------
Function GetDsnLstName(b)
   Dim row:row = b             '画面位置(行)
   Dim col:col = 11            '画面位置(列)
   Dim LenToGet:LenToGet = 44
   GetDsnLstName = Trim(emlECLPSObj.GetText(row, col, LenToGet))
End Function

' VOLUMEの取得 -----------------------------------
Function GetVokumeName(b)
   'VOL名とマルチVOLフラグ
   Dim row:row = b             '画面位置(行)
   Dim col:col = 74            '画面位置(列)
   Dim LenToGet:LenToGet = 7
   GetVokumeName = Trim(emlECLPSObj.GetText(row, col, LenToGet))
End Function

' SPCの取得 --------------------------------------
Function GetSPACE(b)
   Dim row:row = b             '画面位置(行)
   Dim col:col = 55            '画面位置(列)
   Dim LenToGet:LenToGet = 25
   GetSPACE = Trim(emlECLPSObj.GetText(row, col,LenToGet))
End Function

' 属性の取得 -------------------------------------
Function GetATTR(b)
   Dim row:row = b             '画面位置(行)
   Dim col:col = 55            '画面位置(列)
   Dim LenToGet:LenToGet = 26
   GetATTR = Trim(emlECLPSObj.GetText(row, col,LenToGet))
End Function

' カーソル位置の取得 -----------------------------
Function CurPos
   ' -カーソル位置の行数,桁数を取得-
   Dim lCursorPosRow, lCursorPosCol
   lCursorPosRow = emlECLPSObj.CursorPosRow
   lCursorPosCol = emlECLPSObj.CursorPosCol
   sMsg= "カーソル位置:" & lCursorPosRow & " 行 " &lCursorPosCol & " 列 "
   'MsgBox sMsg,,64, sTitle
End Function

' 画面サイズの取得 -------------------------------
Function GetMapSize
   '-表示スペース内での行数,桁数を取得-
   Dim lNumRows, lNumCols
   lNumRows = emlECLPSObj.NumRows
   lNumCols = emlECLPSObj.NumCols
   sMsg= "表示スペース:" & LNumRows & " 行 " & INumCols & " 列 "
   'MsgBox sMsg,,64, sTitle
End Function

' 接続情報の取得 ---------------------------------
Function ConnectInfo
   '接続に関する情報
   Dim sNameCommStarted, lHandle, sConnType
   sName = emlECLPSObj.Name
   lHandle = emlECLPSObj.Handle
   sConnType = emlECLPSObj.ConnType
   sMsg = "接続情報 Name: " & sName & _
          "lHandle      : " & lHandle & _
          "sConnType    : " & sConnType
  'MsgBox sMsg,, 64, sTitle
End Function

' 共通プロパティの取得  --------------------------
Function GetCommonMacroname
   GetCommonMacroname = ThisMacroName
End Function
Function GetCommonSessionName
   GetCommonSessionName = ThisSessionName
End Function

' コードページの取得 ------------------------------
Function GetCodePage
   'コードページ
   Dim ICodePage, sMsgCode
   ICodePage = emlECLPSObj.CodePage
   sMsgCode = "CodePage   :" & ICodePage
   GetCodePage = sMsgCode
End Function

' -----------------------------------------------------
' ヘルスチェック  利用可能判定
' -----------------------------------------------------
Function IsEnableEnv(sTitle)
   Dim bStarted:bStarted = emlECLPSObj.Started             '
   Dim bCommStarted:bCommStarted = emlECLPSObj.CommStarted '
   Dim bAPIEnabled:bAPIEnabled = emlECLPSObj.APIEnabled    '
   Dim bReady:bReady = emlECLPSObj.Ready                   '
   '
   IsEnableEnv = False
   If (bStarted = True and _
       bCommStarted = True and _
       bAPIEnabled = True and _
       bReady = True) Then
       IsEnableEnv = True
   Else
       sMsg = " Started     :" & bStarted & vbCrlf & _
              " CommStarted :" & bCommStarted & vbCrlf & _
              " APIEnabled  :" & bAPIEnabled & vbCrlf & _
              " Ready       :" & bReady
       Msgbox sMsg,64,sTitle
   End If
End Function