@@ -63,7 +63,7 @@ static int handle_dcb_abend(ZDIAG *PTR32 diag, IO_CTRL *PTR32 ioc, const char *P
6363 if (0 == diag -> e_msg_len )
6464 {
6565 strcpy (diag -> service_name , operation );
66- diag -> e_msg_len = sprintf (diag -> e_msg , "DCB abend during %s for %8.8s data set: %44.44s" ,
66+ ZDIAG_SET_MSG (diag , "DCB abend during %.16s for %8.8s data set: %44.44s" ,
6767 operation , ioc -> ddname , ioc -> jfcb .jfcbdsnm );
6868 diag -> detail_rc = ZDS_RTNCD_DCB_ABEND_ERROR ;
6969 }
@@ -78,15 +78,15 @@ static int validate_jfcb_attributes(ZDIAG *PTR32 diag, IO_CTRL *PTR32 ioc)
7878
7979 if (ioc -> jfcb .jfcbind1 != jfcpds )
8080 {
81- diag -> e_msg_len = sprintf (diag -> e_msg , "DDname: %8.8s data set: %44.44s is not a PDS: %X" , ioc -> dcb .dcbddnam , ioc -> jfcb .jfcbdsnm , ioc -> jfcb .jfcbind1 );
81+ ZDIAG_SET_MSG (diag , "DDname: %8.8s data set: %44.44s is not a PDS: %X" , ioc -> dcb .dcbddnam , ioc -> jfcb .jfcbdsnm , ioc -> jfcb .jfcbind1 );
8282 diag -> detail_rc = ZDS_RTNCD_UNSUPPORTED_DATA_SET ;
8383 return RTNCD_FAILURE ;
8484 }
8585
8686 // ensure member name (e.g. is a partitioned data set)
8787 if (ioc -> jfcb .jfcbelnm [0 ] == ' ' )
8888 {
89- diag -> e_msg_len = sprintf (diag -> e_msg , "DDname: %8.8s data set: %44.44s is not a partitioned data set: %s " , ioc -> dcb .dcbddnam , ioc -> jfcb .jfcbdsnm , ioc -> jfcb .jfcbelnm );
89+ ZDIAG_SET_MSG (diag , "DDname: %8.8s data set: %44.44s is not a partitioned data set: %.8s " , ioc -> dcb .dcbddnam , ioc -> jfcb .jfcbdsnm , ioc -> jfcb .jfcbelnm );
9090 diag -> detail_rc = ZDS_RTNCD_UNSUPPORTED_DSORG ;
9191 return RTNCD_FAILURE ;
9292 }
@@ -107,7 +107,7 @@ static int enq_data_set(ZDIAG *PTR32 diag, IO_CTRL *PTR32 ioc)
107107 {
108108 diag -> service_rc = rc ;
109109 strcpy (diag -> service_name , "ENQ" );
110- diag -> e_msg_len = sprintf (diag -> e_msg , "Failed to ENQ ddname: %8.8s data set: %44.44s rc was: %d" , ioc -> dcb .dcbddnam , ioc -> jfcb .jfcbdsnm , rc );
110+ ZDIAG_SET_MSG (diag , "Failed to ENQ ddname: %8.8s data set: %44.44s rc was: %d" , ioc -> dcb .dcbddnam , ioc -> jfcb .jfcbdsnm , rc );
111111 diag -> detail_rc = ZDS_RTNCD_ENQ_ERROR ;
112112 return RTNCD_FAILURE ;
113113 }
@@ -147,7 +147,7 @@ static int get_ucb(ZDIAG *PTR32 diag, IO_CTRL *PTR32 ioc)
147147 if (0 == ioc -> ucb )
148148 {
149149 diag -> detail_rc = ZDS_RTNCD_UCB_ERROR ;
150- diag -> e_msg_len = sprintf (diag -> e_msg , "Failed to get UCB for data set: %44.44s" , ioc -> jfcb .jfcbdsnm );
150+ ZDIAG_SET_MSG (diag , "Failed to get UCB for data set: %44.44s" , ioc -> jfcb .jfcbdsnm );
151151 return RTNCD_FAILURE ;
152152 }
153153
@@ -167,7 +167,7 @@ static int reserve_data_set(ZDIAG *PTR32 diag, IO_CTRL *PTR32 ioc)
167167 {
168168 diag -> service_rc = rc ;
169169 strcpy (diag -> service_name , "RESERVE" );
170- diag -> e_msg_len = sprintf (diag -> e_msg , "Failed to RESERVE ddname: %8.8s data set: %44.44s rc was: %d" , ioc -> dcb .dcbddnam , ioc -> jfcb .jfcbdsnm , rc );
170+ ZDIAG_SET_MSG (diag , "Failed to RESERVE ddname: %8.8s data set: %44.44s rc was: %d" , ioc -> dcb .dcbddnam , ioc -> jfcb .jfcbdsnm , rc );
171171 diag -> detail_rc = ZDS_RTNCD_RESERVE_ERROR ;
172172 return RTNCD_FAILURE ;
173173 }
@@ -184,7 +184,7 @@ static int open_data_set(ZDIAG *PTR32 diag, IO_CTRL *PTR32 ioc)
184184 {
185185 diag -> service_rc = rc ;
186186 strcpy (diag -> service_name , "OPEN" );
187- diag -> e_msg_len = sprintf (diag -> e_msg , "Failed to open ddname: %8.8s for data set: %44.44s rc was: %d" , ioc -> dcb .dcbddnam , ioc -> jfcb .jfcbdsnm , rc );
187+ ZDIAG_SET_MSG (diag , "Failed to open ddname: %8.8s for data set: %44.44s rc was: %d" , ioc -> dcb .dcbddnam , ioc -> jfcb .jfcbdsnm , rc );
188188 diag -> detail_rc = ZDS_RTNCD_OPEN_ERROR ;
189189 return RTNCD_FAILURE ;
190190 }
@@ -196,7 +196,7 @@ static int open_data_set(ZDIAG *PTR32 diag, IO_CTRL *PTR32 ioc)
196196
197197 if (!(ioc -> dcb .dcboflgs & dcbofopn ))
198198 {
199- diag -> e_msg_len = sprintf (diag -> e_msg , "Data set is not open: %44.44s" , ioc -> jfcb .jfcbdsnm );
199+ ZDIAG_SET_MSG (diag , "Data set is not open: %44.44s" , ioc -> jfcb .jfcbdsnm );
200200 diag -> detail_rc = ZDS_RTNCD_NOT_OPEN_ERROR ;
201201 return RTNCD_FAILURE ;
202202 }
@@ -210,7 +210,7 @@ static int validate_dcb_attributes(ZDIAG *PTR32 diag, IO_CTRL *PTR32 ioc)
210210
211211 if (!(ioc -> dcb .dcbrecfm & (dcbrecf | dcbrecv )))
212212 {
213- diag -> e_msg_len = sprintf (diag -> e_msg , "Data set is not a fixed or variable record format: %X" , ioc -> dcb .dcbrecfm );
213+ ZDIAG_SET_MSG (diag , "Data set is not a fixed or variable record format: %X" , ioc -> dcb .dcbrecfm );
214214 diag -> detail_rc = ZDS_RTNCD_UNSUPPORTED_RECFM ;
215215 return RTNCD_FAILURE ;
216216 }
@@ -219,7 +219,7 @@ static int validate_dcb_attributes(ZDIAG *PTR32 diag, IO_CTRL *PTR32 ioc)
219219
220220 if (block_size < 1 )
221221 {
222- diag -> e_msg_len = sprintf (diag -> e_msg , "Data set has less than 1 block size: %X" , block_size );
222+ ZDIAG_SET_MSG (diag , "Data set has less than 1 block size: %X" , block_size );
223223 diag -> detail_rc = ZDS_RTNCD_UNSUPPORTED_BLOCK_SIZE ;
224224 return RTNCD_FAILURE ;
225225 }
@@ -231,7 +231,7 @@ static int validate_dcb_attributes(ZDIAG *PTR32 diag, IO_CTRL *PTR32 ioc)
231231 // Fixed-length record validation
232232 if (block_size % ioc -> dcb .dcblrecl != 0 )
233233 {
234- diag -> e_msg_len = sprintf (diag -> e_msg , "Data set block size is not a multiple of the record length: %d not evenly divisible by %d" , ioc -> dcb .dcbblksi , ioc -> dcb .dcblrecl );
234+ ZDIAG_SET_MSG (diag , "Data set block size is not a multiple of the record length: %d not evenly divisible by %d" , ioc -> dcb .dcbblksi , ioc -> dcb .dcblrecl );
235235 diag -> detail_rc = ZDS_RTNCD_INVALID_BLOCK_SIZE ;
236236 return RTNCD_FAILURE ;
237237 }
@@ -241,7 +241,7 @@ static int validate_dcb_attributes(ZDIAG *PTR32 diag, IO_CTRL *PTR32 ioc)
241241 // Variable-length record validation: block size must be >= LRECL + 4 (for BDW)
242242 if (block_size < ioc -> dcb .dcblrecl + sizeof (BDW ))
243243 {
244- diag -> e_msg_len = sprintf (diag -> e_msg , "Data set block size is too small for variable records: %d < %d (LRECL + 4)" , block_size , ioc -> dcb .dcblrecl + sizeof (BDW ));
244+ ZDIAG_SET_MSG (diag , "Data set block size is too small for variable records: %d < %d (LRECL + 4)" , block_size , ioc -> dcb .dcblrecl + sizeof (BDW ));
245245 diag -> detail_rc = ZDS_RTNCD_INVALID_BLOCK_SIZE ;
246246 return RTNCD_FAILURE ;
247247 }
@@ -263,7 +263,7 @@ static int note_member(ZDIAG *PTR32 diag, IO_CTRL *PTR32 ioc, NOTE_RESPONSE *PTR
263263 {
264264 diag -> service_rc = rc ;
265265 strcpy (diag -> service_name , "NOTE" );
266- diag -> e_msg_len = sprintf (diag -> e_msg , "Failed to NOTE ddname: %8.8s data set: %44.44s rc was: %d" , ioc -> ddname , ioc -> jfcb .jfcbdsnm , rc );
266+ ZDIAG_SET_MSG (diag , "Failed to NOTE ddname: %8.8s data set: %44.44s rc was: %d" , ioc -> ddname , ioc -> jfcb .jfcbdsnm , rc );
267267 diag -> detail_rc = ZDS_RTNCD_NOTE_ERROR ;
268268 }
269269 }
@@ -303,7 +303,7 @@ int open_input_vsam(ZDIAG *PTR32 diag, IO_CTRL *PTR32 *PTR32 ioc, const char *PT
303303 {
304304 diag -> detail_rc = ZDS_RTNCD_SERVICE_FAILURE ;
305305 strcpy (diag -> service_name , "MODCB" );
306- diag -> e_msg_len = sprintf (diag -> e_msg , "MODCB failed rc was: %d rsn was: %d" , rc , rsn );
306+ ZDIAG_SET_MSG (diag , "MODCB failed rc was: %d rsn was: %d" , rc , rsn );
307307 diag -> service_rc = rc ;
308308 diag -> service_rsn = rsn ;
309309 return RTNCD_FAILURE ;
@@ -314,7 +314,7 @@ int open_input_vsam(ZDIAG *PTR32 diag, IO_CTRL *PTR32 *PTR32 ioc, const char *PT
314314 {
315315 diag -> detail_rc = ZDS_RTNCD_SERVICE_FAILURE ;
316316 strcpy (diag -> service_name , "OPEN" );
317- diag -> e_msg_len = sprintf (diag -> e_msg , "Failed to open acb rc was: %d" , rc );
317+ ZDIAG_SET_MSG (diag , "Failed to open acb rc was: %d" , rc );
318318 diag -> service_rc = rc ;
319319 return RTNCD_FAILURE ;
320320 }
@@ -341,7 +341,7 @@ int point_input_vsam(ZDIAG *PTR32 diag, IO_CTRL *PTR32 ioc, TIME_STRUCT *time_st
341341 {
342342 diag -> detail_rc = ZDS_RTNCD_SERVICE_FAILURE ;
343343 strcpy (diag -> service_name , "CONVTOD" );
344- diag -> e_msg_len = sprintf (diag -> e_msg , "Failed to CONVTOD rc was: %d" , rc );
344+ ZDIAG_SET_MSG (diag , "Failed to CONVTOD rc was: %d" , rc );
345345 diag -> service_rc = rc ;
346346 return rc ;
347347 }
@@ -358,7 +358,7 @@ int point_input_vsam(ZDIAG *PTR32 diag, IO_CTRL *PTR32 ioc, TIME_STRUCT *time_st
358358 {
359359 diag -> detail_rc = ZDS_RTNCD_SERVICE_FAILURE ;
360360 strcpy (diag -> service_name , "POINT" );
361- diag -> e_msg_len = sprintf (diag -> e_msg , "Failed to POINT rc was: %d" , rc );
361+ ZDIAG_SET_MSG (diag , "Failed to POINT rc was: %d" , rc );
362362 diag -> service_rc = rc ;
363363 return rc ;
364364 }
@@ -392,7 +392,7 @@ int read_input_vsam(ZDIAG *PTR32 diag, IO_CTRL *PTR32 ioc)
392392 diag -> detail_rc = ZDS_RTNCD_SERVICE_FAILURE ;
393393 strcpy (diag -> service_name , "GET" );
394394 memcpy (rplrdbk , & rplp -> rplfdbwd .rplfdbk , sizeof (rplrdbk ));
395- diag -> e_msg_len = sprintf (diag -> e_msg , "Failed to GET rc was: %d, RPLRDBK was: %02X%02X%02X" , rc , rplrdbk [0 ], rplrdbk [1 ], rplrdbk [2 ]);
395+ ZDIAG_SET_MSG (diag , "Failed to GET rc was: %d, RPLRDBK was: %02X%02X%02X" , rc , rplrdbk [0 ], rplrdbk [1 ], rplrdbk [2 ]);
396396 diag -> service_rc = rc ;
397397 return rc ;
398398 }
@@ -410,7 +410,7 @@ int close_input_vsam(ZDIAG *PTR32 diag, IO_CTRL *PTR32 ioc)
410410 {
411411 diag -> detail_rc = ZDS_RTNCD_SERVICE_FAILURE ;
412412 strcpy (diag -> service_name , "CLOSE" );
413- diag -> e_msg_len = sprintf (diag -> e_msg , "Failed to close acb rc was: %d" , rc );
413+ ZDIAG_SET_MSG (diag , "Failed to close acb rc was: %d" , rc );
414414 diag -> service_rc = rc ;
415415 return RTNCD_FAILURE ;
416416 }
@@ -454,7 +454,7 @@ int open_output_bpam(ZDIAG *PTR32 diag, IO_CTRL *PTR32 *PTR32 ioc, const char *P
454454 {
455455 diag -> detail_rc = ZDS_RTNCD_SERVICE_FAILURE ;
456456 strcpy (diag -> service_name , "RDJFCB" );
457- diag -> e_msg_len = sprintf (diag -> e_msg , "Failed to read output JFCB rc was: %d" , rc );
457+ ZDIAG_SET_MSG (diag , "Failed to read output JFCB rc was: %d" , rc );
458458 diag -> service_rc = rc ;
459459 return RTNCD_FAILURE ;
460460 }
@@ -559,7 +559,7 @@ static int handle_fixed_record(ZDIAG *PTR32 diag, IO_CTRL *PTR32 ioc, const char
559559
560560 if (0 != rc )
561561 {
562- diag -> e_msg_len = sprintf (diag -> e_msg , "Failed to write record rc was: %d" , rc );
562+ ZDIAG_SET_MSG (diag , "Failed to write record rc was: %d" , rc );
563563 diag -> detail_rc = ZDS_RTNCD_SERVICE_FAILURE ;
564564 diag -> service_rc = rc ;
565565 return RTNCD_FAILURE ;
@@ -607,7 +607,7 @@ static int write_variable_record(ZDIAG *PTR32 diag, IO_CTRL *PTR32 ioc, const ch
607607
608608 if (0 != rc )
609609 {
610- diag -> e_msg_len = sprintf (diag -> e_msg , "Failed to write record rc was: %d" , rc );
610+ ZDIAG_SET_MSG (diag , "Failed to write record rc was: %d" , rc );
611611 diag -> detail_rc = ZDS_RTNCD_SERVICE_FAILURE ;
612612 diag -> service_rc = rc ;
613613 return RTNCD_FAILURE ;
@@ -626,7 +626,8 @@ static void copy_variable_record(IO_CTRL *PTR32 ioc, const char *PTR32 data, int
626626 ioc -> lines_written ++ ;
627627 RDW * PTR32 rdw_ptr = (RDW * PTR32 ) ioc -> free_location ;
628628 rdw_ptr -> unused = 0 ;
629- rdw_ptr -> len = sprintf (ioc -> free_location + sizeof (RDW ), "%.*s" , length , data ) + sizeof (RDW );
629+ memcpy (ioc -> free_location + sizeof (RDW ), data , length );
630+ rdw_ptr -> len = length + sizeof (RDW );
630631 ioc -> bytes_in_buffer += rdw_ptr -> len ;
631632 ioc -> free_location += rdw_ptr -> len ;
632633}
@@ -736,7 +737,7 @@ static int write_flush(ZDIAG *PTR32 diag, IO_CTRL *PTR32 ioc)
736737
737738 if (0 != rc )
738739 {
739- diag -> e_msg_len = sprintf (diag -> e_msg , "Failed to write record rc was: %d" , rc );
740+ ZDIAG_SET_MSG (diag , "Failed to write record rc was: %d" , rc );
740741 diag -> detail_rc = ZDS_RTNCD_SERVICE_FAILURE ;
741742 diag -> service_rc = rc ;
742743 return RTNCD_FAILURE ;
@@ -763,7 +764,7 @@ static int bldl_member(ZDIAG *PTR32 diag, IO_CTRL *PTR32 ioc, BLDL_PL *PTR32 bld
763764 {
764765 diag -> service_rc = rc ;
765766 strcpy (diag -> service_name , "BLDL" );
766- diag -> e_msg_len = sprintf (diag -> e_msg , "Failed to BLDL ddname: %8.8s data set: %44.44s rc was: %d" , ioc -> ddname , ioc -> jfcb .jfcbdsnm , rc );
767+ ZDIAG_SET_MSG (diag , "Failed to BLDL ddname: %8.8s data set: %44.44s rc was: %d" , ioc -> ddname , ioc -> jfcb .jfcbdsnm , rc );
767768 diag -> detail_rc = ZDS_RTNCD_BLDL_ERROR ;
768769 }
769770 return rc ;
@@ -818,7 +819,7 @@ static int update_ispf_statistics(ZDIAG *PTR32 diag, IO_CTRL *PTR32 ioc)
818819 rc = zutm1gur (user );
819820 if (0 != rc )
820821 {
821- diag -> e_msg_len = sprintf (diag -> e_msg , "Failed to get userid rc was: %d" , rc );
822+ ZDIAG_SET_MSG (diag , "Failed to get userid rc was: %d" , rc );
822823 diag -> detail_rc = ZDS_RTNCD_SERVICE_FAILURE ;
823824 diag -> service_rc = rc ;
824825 return RTNCD_FAILURE ;
@@ -868,7 +869,7 @@ static int update_ispf_statistics(ZDIAG *PTR32 diag, IO_CTRL *PTR32 ioc)
868869 rc = zutm1gur (user );
869870 if (0 != rc )
870871 {
871- diag -> e_msg_len = sprintf (diag -> e_msg , "Failed to get userid rc was: %d" , rc );
872+ ZDIAG_SET_MSG (diag , "Failed to get userid rc was: %d" , rc );
872873 diag -> detail_rc = ZDS_RTNCD_SERVICE_FAILURE ;
873874 diag -> service_rc = rc ;
874875 return RTNCD_FAILURE ;
@@ -922,7 +923,7 @@ static int stow_data_set(ZDIAG *PTR32 diag, IO_CTRL *PTR32 ioc)
922923 {
923924 diag -> service_rc = rc ;
924925 strcpy (diag -> service_name , "STOW" );
925- diag -> e_msg_len = sprintf (diag -> e_msg , "Failed to STOW ISPF statistics: %8.8s data set: %44.44s rsn was: %d" , ioc -> ddname , ioc -> jfcb .jfcbdsnm , rsn );
926+ ZDIAG_SET_MSG (diag , "Failed to STOW ISPF statistics: %8.8s data set: %44.44s rsn was: %d" , ioc -> ddname , ioc -> jfcb .jfcbdsnm , rsn );
926927 diag -> detail_rc = ZDS_RTNCD_STOW_ERROR ;
927928 }
928929 }
@@ -946,7 +947,7 @@ static int close_data_set(ZDIAG *PTR32 diag, IO_CTRL *PTR32 ioc)
946947 {
947948 diag -> service_rc = rc ;
948949 strcpy (diag -> service_name , "CLOSE" );
949- diag -> e_msg_len = sprintf (diag -> e_msg , "Failed to close ddname: %8.8s data set: %44.44s rc was: %d" , ioc -> ddname , ioc -> jfcb .jfcbdsnm , rc );
950+ ZDIAG_SET_MSG (diag , "Failed to close ddname: %8.8s data set: %44.44s rc was: %d" , ioc -> ddname , ioc -> jfcb .jfcbdsnm , rc );
950951 diag -> detail_rc = ZDS_RTNCD_CLOSE_ERROR ;
951952 }
952953 }
@@ -969,7 +970,7 @@ static int deq_reserve_data_set(ZDIAG *PTR32 diag, IO_CTRL *PTR32 ioc)
969970 {
970971 diag -> service_rc = rc ;
971972 strcpy (diag -> service_name , "DEQ RESERVE" );
972- diag -> e_msg_len = sprintf (diag -> e_msg , "Failed to DEQ RESERVE ddname: %8.8s data set: %44.44s rc was: %d" , ioc -> ddname , ioc -> jfcb .jfcbdsnm , rc );
973+ ZDIAG_SET_MSG (diag , "Failed to DEQ RESERVE ddname: %8.8s data set: %44.44s rc was: %d" , ioc -> ddname , ioc -> jfcb .jfcbdsnm , rc );
973974 diag -> detail_rc = ZDS_RTNCD_DEQ_RESERVE_ERROR ;
974975 }
975976 return rc ;
@@ -995,7 +996,7 @@ static int deq_data_set(ZDIAG *PTR32 diag, IO_CTRL *PTR32 ioc)
995996 {
996997 diag -> service_rc = rc ;
997998 strcpy (diag -> service_name , "DEQ" );
998- diag -> e_msg_len = sprintf (diag -> e_msg , "Failed to DEQ ddname: %8.8s data set: %44.44s rc was: %d" , ioc -> ddname , ioc -> jfcb .jfcbdsnm , rc );
999+ ZDIAG_SET_MSG (diag , "Failed to DEQ ddname: %8.8s data set: %44.44s rc was: %d" , ioc -> ddname , ioc -> jfcb .jfcbdsnm , rc );
9991000 diag -> detail_rc = ZDS_RTNCD_DEQ_ERROR ;
10001001 }
10011002 }
0 commit comments