IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Extract the file name from another file and use it further.


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Digvijay Singh

Active User


Joined: 20 Apr 2022
Posts: 141
Location: India

PostPosted: Tue Apr 02, 2024 8:56 pm
Reply with quote

HI Everyone.

I have one file Input file lets say ABC.DVJ.File1 inside that input file I have another file name listed as name ABC.DVJ.FILE2 i want to extract this file and use it in my further step to copy the data from file ABC.DVJ.FILE2 to another file.

I have idea to do it with rexx I am just looking out way to do it with sort , Any idea to suggestion or sort step or any link to do refer this type of sorting would be great help here.

step1: I have already extracted the file name ABC.DVJ.FILE2 from file ABC.DVJ.File1 and it is being kept in one file from position 1 to 12.

step2 I want to use the extracted file name ABC.DVJ.FILE2 kept in output of above step as sortin to extract the data from it and copy it to another file.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2030
Location: USA

PostPosted: Tue Apr 02, 2024 9:36 pm
Reply with quote

Any example of the REAL WORKING code: what have you tried so far?
Please, in coupe with all input/output/error information.

A hint (one of many):
Code:
//REPRO EXEC PGM=IDCAMS
// . . . . . .
//COPYDATA DD  DISP=(NEW,PASS),
//              . . . . . . ,DCB=(required),
//             DSN=&&COPYDATA
//SYSIN    DD  *
 REPRO INDATASET('extracted dsname here') -
       OUTFILE(COPYDATA)
//*
//SORT EXEC PGM=SORT,COND=(4,LT)
// . . . . . . . . . . .
//SORTIN  DD  DISP=(OLD,DELETE),DSN=&&COPYDATA
// . . . . . . . .



Another hint:
Code:
// EXPORT SYMLIST=*
// . . . . . .
//ALIAS EXEC PGM=IDCAMS
// . . . . . .
//SYSIN    DD  *,SYMBOLS=EXECSYS
 DELETE -
        '&SYSUID..UNIQUE.NAME.TO.HANDLE' -
         ALIAS
 DEFINE ALIAS -
        ( NAME('&SYSUID..UNIQUE.NAME.TO.HANDLE') -
         RELATE('extracted dsname here') )
//*
//SORT EXEC PGM=SORT,COND=(4,LT)
// . . . . . . . . . . .
//SORTIN  DD  DISP=SHR,DSN=&SYSUID..UNIQUE.NAME.TO.HANDLE
// . . . . . . . .
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1269
Location: Bamberg, Germany

PostPosted: Wed Apr 03, 2024 6:23 am
Reply with quote

I don't see why it would be a good idea to hide the dataset name in another dataset. Looks like a not so clever attempt of obfuscation.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1269
Location: Bamberg, Germany

PostPosted: Wed Apr 03, 2024 6:54 am
Reply with quote

Code:
//PARSE    EXEC PGM=ICEMAN                             
//SORTIN   DD *                                                       
WHATEVER.INPUT.DSN                                                             
/*                                                                   
//SYSOUT   DD SYSOUT=*                                               
//SORTOUT  DD DISP=(NEW,PASS),UNIT=SYSALLDA,                         
//            SPACE=(TRK,(1,0)),                                     
//            DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=0                   
//SYSIN    DD *                                                       
  OPTION COPY                                                         
  INREC BUILD=(1,44,JFY=(SHIFT=LEFT,LEAD=C' REPRO IDS(',             
                         TRAIL=C') ODS(ABCD.ANOTHER.DSN)',LENGTH=80))
  END                                                                 
/*                                                                   
//REPRO    EXEC PGM=IDCAMS                                           
//SYSIN    DD DISP=(OLD,PASS),DSN=*.PARSE.SORTOUT                     
//SYSPRINT DD SYSOUT=*
Back to top
View user's profile Send private message
Digvijay Singh

Active User


Joined: 20 Apr 2022
Posts: 141
Location: India

PostPosted: Wed Apr 03, 2024 7:36 pm
Reply with quote

Thanks @ Joerg.Findeisen

Could you please help me to understand the sort card that you ar e using above to achieve this..?

Code:
/SYSIN    DD *                                                       
  OPTION COPY                                                         
  INREC BUILD=(1,44,JFY=(SHIFT=LEFT,LEAD=C' REPRO IDS(',             
                         TRAIL=C') ODS(ABCD.ANOTHER.DSN)',LENGTH=80))
  END               

and

//SYSIN    DD DISP=(OLD,PASS),DSN=*.PARSE.SORTOUT                     
//SYSPRINT DD SYSOUT=*
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1269
Location: Bamberg, Germany

PostPosted: Wed Apr 03, 2024 7:57 pm
Reply with quote

Basically the SORT step sends the IDCAMS REPRO command to a temporary DSN which is passed to the next step as DD:SYSIN

Code:
Data set name copied from                               
an earlier DD statement - *.ddname                       
                          *.stepname.ddname             
                          *.stepname.procstepname.ddname
Back to top
View user's profile Send private message
Digvijay Singh

Active User


Joined: 20 Apr 2022
Posts: 141
Location: India

PostPosted: Fri Apr 05, 2024 8:43 pm
Reply with quote

Thank you Everyone it worked with little modification. I have actually two ways to do one with Rexx and one with JCL , I started working on with Rexx so it worked for me. I will surely try this solution in my coming requirements.

Thank to all of you .
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Binary File format getting change whi... All Other Mainframe Topics 7
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top