Looking for a snippet to use LMMSTATS to set ISPF statistics #443
Replies: 3 comments 1 reply
-
|
@MarcBauer-LM could you share a snippet how you have addressed your use case? 🙏 |
Beta Was this translation helpful? Give feedback.
-
|
Hey Dennis, curious if you ever tracked down a sample to use? Also, will this functionality be added to DBB in the future? Thanks! |
Beta Was this translation helpful? Give feedback.
-
|
Hi, I think that the ISPF statistics are not updated because it must be a file copy and not a write directly to the PDS member, (ISPF has the same behavior if we copy PDS members: it transfers the statistics, it does not modify them). Copilot suggestion: To update the statistics of a PDS member on z/OS, you will need to edit the member in question. Statistics such as the last modification date and the user who made the last modification will be updated automatically by the system. Here is an example of Java code that opens a PDS member, adds a line of text to it, and thus updates the statistics: import com.ibm.jzos.ZFile;
import com.ibm.jzos.PdsDirectory;
public class UpdatePdsMemberStats {
public static void main(String[] args) {
try {
String pdsName = "//DD:MY.PDS";
String memberName = "MYMEMBER";
String memberPath = pdsName + "(" + memberName + ")";
// Open PDS member for writing
ZFile memberFile = new ZFile(memberPath, "wb,type=record");
// Add a text line to member
String newText = "This is a new line of text.";
memberFile.write(newText.getBytes());
memberFile.close();
// Display new member statistics
PdsDirectory dir = new PdsDirectory(pdsName);
for (Iterator iter = dir.iterator(); iter.hasNext(); ) {
PdsDirectory.MemberInfo info = (PdsDirectory.MemberInfo) iter.next();
if (info.getMemberName().equals(memberName)) {
System.out.println("Updated Member Name: " + info.getMemberName());
System.out.println("Updated Creation Date: " + info.getCreateDate());
System.out.println("Updated Last Modification Date: " + info.getChangeDate());
System.out.println("Updated Last Modified By: " + info.getChangeUserId());
System.out.println("Updated Number of Lines: " + info.getNumberOfLines());
System.out.println("Updated Member Size: " + info.getSize());
System.out.println("Updated Number of Changes: " + info.getNumberOfChanges());
System.out.println("--------------------------------");
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}This code opens a specified PDS member in write mode, adds a line of text, and closes the file. Then it displays the new statistics for the member. Statistics such as the last modification date and the user who made the modification are updated automatically by the z/OS system when the member is written. What happens if we write 0 bytes? Are the statistics changed? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
The libraries used for zAppBuild need to seen as temporary. However there might be use cases, that are based on existing ISPF statistics .
Anyone with a small snippet how they included it and is willing to share?
It requires to use a TSO/ISPF Exec to invoke the LMMSTATS service
Beta Was this translation helpful? Give feedback.
All reactions