Monitoring for copy errors

 

When an error occurs, the escape message CPF2817 is sent to indicate many different error conditions. Except for the empty from-file member case, which is described later, when this message is sent:

The CPF2817 escape message is always preceded by at least one diagnostic message that indicates the specific error condition. The message identifier of the diagnostic message, which immediately precedes the CPF2817 escape message is used as message replacement data (MSGDTA parameter on the Send Program Message (SNDPGMMSG) command) for the CPF2817 escape message. This enables you to monitor for specific error cases from the CPF2817 escape message by using the CMPDTA parameter on the Monitor Message (MONMSG) command. For example, message CPF2802 is a diagnostic message. It indicates that the from-file cannot be found. You can monitor for just the from-file not found condition as follows:

PGM            /* The replacement text of escape            CPF2817 contains the msg ID            CPF2802 for the 'from-file not            found' condition */
CPYF  FROMFILE(NOLIB/NOFILE) TOFILE(D504/KEY) +
  FROMMBR(NOMBR) TOMBR(MBR1) MBROPT(*ADD)
MONMSG MSGID(CPF2817) CMPDTA(CPF2802) +
  EXEC(SNDPGMMSG TOPGMQ(*EXT) +
  MSG('File NOFILE in NOLIB not found'))
ENDPGM

Any error other than from-file not found, including any other error reported with a CPF2817 escape message, causes a check in this program because the MONMSG command applies only to the CPF2817 escape message when it has the compare data from message CPF2802.

If you are running the Copy From Query File (CPYFRMQRYF) command, it does not normally close the open query file after completing the copy operation. However, if you are running the CPYFRMQRYF command from a command entry line, any error messages occurring after the Open Query File (OPNQRYF) command is successfully run will close the file unless you specified TYPE(*PERM) on the OPNQRYF command. The system automatically runs a Reclaim Resources (RCLRSC) command if an error message occurs. If the OPNQRYF command specifys TYPE(*PERM), the system does not automatically close the file.

The following messages can be sent as diagnostic messages, followed immediately by a CPF2817 escape message. Some of these messages can also be sent as other message types (such as an informational or escape message). When the message is sent as a diagnostic message type, the message identifier appears in the replacement text of the CPF2817 escape message. You can monitor the condition by using the CMPDTA parameter on the MONMSG command:

CPD2807 CPD2808 CPD2809 CPD2810 CPD2811 CPD2812 CPD2825 CPD2968 CPD2969 CPD2970 CPD2971 CPD2972 CPD2973 CPD2974 CPD2975 CPD2976 CPD2979 CPD2980 CPD2981 CPF2801 CPF2802 CPF2803 CPF2804 CPF2805 CPF2806 CPF2807 CPF2808 CPF2810 CPF2811 CPF2812 CPF2813 CPF2814 CPF2816 CPF2819 CPF2820 CPF2821 CPF2822 CPF2823 CPF2825 CPF2826 CPF2827 CPF2831 CPF2832 CPF2833 CPF2834 CPF2836 CPF2837 CPF2839 CPF2840 CPF2841 CPF2842 CPF2843 CPF2844 CPF2847 CPF2848 CPF2849 CPF2851 CPF2853 CPF2854 CPF2855 CPF2856 CPF2857 CPF2860 CPF2861 CPF2862 CPF2863 CPF2864 CPF2865 CPF2868 CPF2869 CPF2870 CPF2871 CPF2872 CPF2873 CPF2874 CPF2877 CPF2878 CPF2879 CPF2881 CPF2883 CPF2884 CPF2890 CPF2891 CPF2893 CPF2960 CPF2962 CPF2963 CPF2965 CPF2969 CPF9807 CPF9808 CPF9820 CPF9830

 

Parent topic:

Copying files: Basic functions