public static ILEObject[] GetObjectList(string Lib, string Types = "*PGM *SRVPGM *MODULE") { string Line = ""; ILEObject Object; List <ILEObject> Objects = new List <ILEObject>(); if (Lib == "*CURLIB") { Lib = IBMi.CurrentSystem.GetValue("curlib"); } IBMi.RemoteCommand("DLTOBJ OBJ(QTEMP/OBJLIST) OBJTYPE(*FILE)", false); IBMi.RemoteCommand("DLTOBJ OBJ(QTEMP/DATA) OBJTYPE(*FILE)", false); IBMi.RemoteCommand("DSPOBJD OBJ(" + Lib + "/*ALL) OBJTYPE(" + Types + ") OUTPUT(*OUTFILE) OUTFILE(QTEMP/objlist)"); IBMi.RemoteCommand("RUNSQL SQL('CREATE TABLE QTEMP/DATA AS (SELECT ODOBNM, ODOBTP, ODOBAT, char(ODOBSZ) as ODOBSZ, ODOBTX, ODOBOW, ODSRCF, ODSRCL, ODSRCM FROM qtemp/objlist order by ODOBNM) WITH DATA') COMMIT(*NONE)"); string file = DownloadMember("QTEMP", "DATA", "DATA"); if (file != "") { foreach (string RealLine in File.ReadAllLines(file)) { if (RealLine.Trim() != "") { Object = new ILEObject(); Line = RealLine.PadRight(135); Object.Library = Lib; Object.Name = Line.Substring(0, 10).Trim(); Object.Type = Line.Substring(10, 8).Trim(); Object.Extension = Line.Substring(18, 10).Trim(); UInt32.TryParse(Line.Substring(28, 12).Trim(), out Object.SizeKB); Object.Text = Line.Substring(40, 50).Trim(); Object.Owner = Line.Substring(90, 10).Trim(); Object.SrcSpf = Line.Substring(100, 10).Trim(); Object.SrcLib = Line.Substring(110, 10).Trim(); Object.SrcMbr = Line.Substring(120, 10).Trim(); Objects.Add(Object); } } } else { return(null); } return(Objects.ToArray()); }
public static ILEObject[] GetSPFList(string Lib) { List <ILEObject> SPFList = new List <ILEObject>(); Lib = Lib.ToUpper(); if (Lib == "*CURLIB") { Lib = IBMi.CurrentSystem.GetValue("curlib"); } if (IBMi.IsConnected()) { string FileA = 'S' + Lib, FileB = "D" + Lib; if (FileA.Length > 10) { FileA = FileA.Substring(0, 10); } if (FileB.Length > 10) { FileB = FileB.Substring(0, 10); } UsingQTEMPFiles(new[] { FileA, FileB }); IBMi.RemoteCommand("DSPFD FILE(" + Lib + "/*ALL) TYPE(*ATR) OUTPUT(*OUTFILE) FILEATR(*PF) OUTFILE(QTEMP/" + FileA + ")"); IBMi.RemoteCommand("RUNSQL SQL('CREATE TABLE QTEMP/" + FileB + " AS (SELECT PHFILE, PHLIB FROM QTEMP/" + FileA + " WHERE PHDTAT = ''S'' order by PHFILE) WITH DATA') COMMIT(*NONE)"); Editor.TheEditor.SetStatus("Fetching source-physical files for " + Lib + "..."); string file = DownloadMember("QTEMP", FileB, FileB); if (file != "") { Boolean validName = true; string Line, Library, Object; ILEObject Obj; foreach (string RealLine in File.ReadAllLines(file)) { if (RealLine.Trim() != "") { validName = true; Line = RealLine.PadRight(31); Object = Line.Substring(0, 10).Trim(); Library = Line.Substring(10, 10).Trim(); Obj = new ILEObject(); Obj.Library = Library; Obj.Name = Object; foreach (string Name in IgnorePFs) { if (Obj.Name.StartsWith(Name)) { validName = false; } } if (validName) { SPFList.Add(Obj); } } } } else { return(null); } Editor.TheEditor.SetStatus("Fetched source-physical files for " + Lib + "."); } else { string DirPath = GetLocalDir(Lib); if (Directory.Exists(DirPath)) { foreach (string dir in Directory.GetDirectories(DirPath)) { SPFList.Add(new ILEObject { Library = Lib, Name = Path.GetDirectoryName(dir) }); } } else { return(null); } } return(SPFList.ToArray()); }
public static ILEObject[] GetObjectList(string Lib, string Types = "*PGM *SRVPGM *MODULE") { if (IBMi.IsConnected()) { string Line = ""; ILEObject Object; List <ILEObject> Objects = new List <ILEObject>(); if (Lib == "*CURLIB") { Lib = IBMi.CurrentSystem.GetValue("curlib"); } string FileA = 'O' + Lib, FileB = "T" + Lib; if (FileA.Length > 10) { FileA = FileA.Substring(0, 10); } if (FileB.Length > 10) { FileB = FileB.Substring(0, 10); } UsingQTEMPFiles(new[] { FileA, FileB }); IBMi.RemoteCommand("DSPOBJD OBJ(" + Lib + "/*ALL) OBJTYPE(" + Types + ") OUTPUT(*OUTFILE) OUTFILE(QTEMP/" + FileA + ")"); IBMi.RemoteCommand("RUNSQL SQL('CREATE TABLE QTEMP/" + FileB + " AS (SELECT ODOBNM, ODOBTP, ODOBAT, char(ODOBSZ) as ODOBSZ, ODOBTX, ODOBOW, ODSRCF, ODSRCL, ODSRCM FROM qtemp/" + FileA + " order by ODOBNM) WITH DATA') COMMIT(*NONE)"); string file = DownloadMember("QTEMP", FileB, FileB); if (file != "") { foreach (string RealLine in File.ReadAllLines(file, Program.Encoding)) { if (RealLine.Trim() != "") { Object = new ILEObject(); Line = RealLine.PadRight(135); Object.Library = Lib; Object.Name = Line.Substring(0, 10).Trim(); Object.Type = Line.Substring(10, 8).Trim(); Object.Extension = Line.Substring(18, 10).Trim(); UInt32.TryParse(Line.Substring(28, 12).Trim(), out Object.SizeKB); Object.Text = Line.Substring(40, 50).Trim(); Object.Owner = Line.Substring(90, 10).Trim(); Object.SrcSpf = Line.Substring(100, 10).Trim(); Object.SrcLib = Line.Substring(110, 10).Trim(); Object.SrcMbr = Line.Substring(120, 10).Trim(); Objects.Add(Object); } } } else { return(null); } return(Objects.ToArray()); } else { return(null); } }
public static ILEObject[] GetSPFList(string Lib) { List <ILEObject> SPFList = new List <ILEObject>(); Lib = Lib.ToUpper(); if (Lib == "*CURLIB") { Lib = IBMi.CurrentSystem.GetValue("curlib"); } IBMi.RemoteCommand("DLTOBJ OBJ(QTEMP/SPFLIST) OBJTYPE(*FILE)", false); IBMi.RemoteCommand("DLTOBJ OBJ(QTEMP/DATA) OBJTYPE(*FILE)", false); IBMi.RemoteCommand("DSPFD FILE(" + Lib + "/*ALL) TYPE(*ATR) OUTPUT(*OUTFILE) FILEATR(*PF) OUTFILE(QTEMP/SPFLIST)"); IBMi.RemoteCommand("RUNSQL SQL('CREATE TABLE QTEMP/DATA AS (SELECT PHFILE, PHLIB FROM QTEMP/SPFLIST WHERE PHDTAT = ''S'' order by PHFILE) WITH DATA') COMMIT(*NONE)"); Editor.TheEditor.SetStatus("Fetching source-physical files for " + Lib + "..."); string file = DownloadMember("QTEMP", "DATA", "DATA"); if (file != "") { Boolean validName = true; string Line, Library, Object; ILEObject Obj; foreach (string RealLine in File.ReadAllLines(file)) { if (RealLine.Trim() != "") { validName = true; Line = RealLine.PadRight(31); Object = Line.Substring(0, 10).Trim(); Library = Line.Substring(10, 10).Trim(); Obj = new ILEObject(); Obj.Library = Library; Obj.Name = Object; foreach (string Name in IgnorePFs) { if (Obj.Name.StartsWith(Name)) { validName = false; } } if (validName) { SPFList.Add(Obj); } } } } else { return(null); } Editor.TheEditor.SetStatus("Fetched source-physical files for " + Lib + "."); return(SPFList.ToArray()); }