@@ -627,21 +627,27 @@ def _fetch_pdse(self, src, is_binary, temp_dir=None, encoding=None):
627
627
Error converting encoding of the member.
628
628
"""
629
629
dir_path = tempfile .mkdtemp (dir = temp_dir )
630
- cmd = "cp -B \" //'{0}'\" {1}"
631
- if not is_binary :
632
- cmd = cmd .replace (" -B" , "" )
633
- rc , out , err = self ._run_command (cmd .format (src , dir_path ))
630
+
631
+ copy_args = {
632
+ "options" : ""
633
+ }
634
+
635
+ if is_binary :
636
+ copy_args ["options" ] = "-B"
637
+
638
+ rc = datasets .copy (source = src , target = file_path , ** copy_args )
639
+
634
640
if rc != 0 :
635
641
rmtree (dir_path )
636
642
self ._fail_json (
637
643
msg = (
638
644
"Error copying partitioned data set {0} to USS. Make sure it is"
639
645
" not empty" .format (src )
640
646
),
641
- stdout = out ,
642
- stderr = err ,
643
- stdout_lines = out . splitlines () ,
644
- stderr_lines = err .splitlines (),
647
+ stdout = "" ,
648
+ stderr = "Error copying partitioned data set {0} to USS. Make sure it is" ,
649
+ stdout_lines = "" ,
650
+ stderr_lines = "Error copying partitioned data set {0} to USS. Make sure it is" .splitlines (),
645
651
rc = rc ,
646
652
)
647
653
if (not is_binary ) and encoding :
@@ -754,21 +760,24 @@ def _fetch_mvs_data(self, src, is_binary, temp_dir=None, file_override=None, enc
754
760
fd , file_path = tempfile .mkstemp (dir = temp_dir )
755
761
os .close (fd )
756
762
757
- cmd = "cp -B \" //'{0}'\" {1}"
758
- if not is_binary :
759
- cmd = cmd .replace (" -B" , "" )
763
+ copy_args = {
764
+ "options" : ""
765
+ }
766
+
767
+ if is_binary :
768
+ copy_args ["options" ] = "-B"
760
769
761
- rc , out , err = self . _run_command ( cmd . format ( src , file_path ) )
770
+ rc = datasets . copy ( source = src , target = file_path , ** copy_args )
762
771
763
772
if rc != 0 :
764
773
os .remove (file_path )
765
774
self ._fail_json (
766
775
msg = "Unable to copy {0} to USS" .format (src ),
767
- stdout = str ( out ) ,
768
- stderr = str ( err ),
776
+ stdout = "" ,
777
+ stderr = "Unable to copy {0} to USS" . format ( src ),
769
778
rc = rc ,
770
- stdout_lines = str ( out ). splitlines () ,
771
- stderr_lines = str ( err ).splitlines (),
779
+ stdout_lines = "" ,
780
+ stderr_lines = "Unable to copy {0} to USS" . format ( src ).splitlines (),
772
781
)
773
782
if (not is_binary ) and encoding :
774
783
enc_utils = encode .EncodeUtils ()
0 commit comments