MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

To Change the first 3 digits of a file

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
manasa
Beginner


Joined: 29 Oct 2008
Posts: 5
Topics: 1

PostPosted: Thu Oct 30, 2008 9:09 am    Post subject: To Change the first 3 digits of a file Reply with quote

Hello,

i have one input dataset with name like AC8.TXXX.INTERFCE.the input file first 3 digits contains the cty code like XXX ..we need to change XXX to AAA and we need to copy same file to diff dataset with name is like AC8.TAAA.INTERFCE..like we have 32 cty codes we need change and need to copy to diff dataset..

Can you please help me..
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Oct 30, 2008 10:30 am    Post subject: Reply with quote

manasa,

The following DFSORT JCL will give you the desired results

Code:

//STEP0100 EXEC  PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD DSN=AC8.TXXX.INTERFCE,
//            DISP=SHR                                   
//AAA      DD DSN=AC8.Taaa.INTERFCE,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(X,Y),RLSE)
/*
//BBB      DD DSN=AC8.TBBB.INTERFCE,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(X,Y),RLSE)
/*
//CCC      DD DSN=AC8.TCCC.INTERFCE,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(X,Y),RLSE)
/*
//DDD      DD DSN=AC8.TDDD.INTERFCE,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(X,Y),RLSE)
/*
... ALL YOUR 32 FILE DEFINITIONS

//SYSIN     DD *                                               
 SORT FIELDS=COPY                                               
 OUTFIL FNAMES=AAA,INCLUDE=(1,3,CH,EQ,C'XXX'),OVERLAY=(1:C'AAA')
 OUTFIL FNAMES=BBB,INCLUDE=(1,3,CH,EQ,C'YYY'),OVERLAY=(1:C'BBB')
 OUTFIL FNAMES=CCC,INCLUDE=(1,3,CH,EQ,C'ZZZ'),OVERLAY=(1:C'CCC')
 ... ALL OTHER 32 OUTFIL STATEMENTS
/*


Hope this helps...

Cheers
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jsharon1248
Intermediate


Joined: 08 Aug 2007
Posts: 291
Topics: 2
Location: Chicago

PostPosted: Thu Oct 30, 2008 12:27 pm    Post subject: Reply with quote

If you can just rename rather than physically copying the datasets, you could utilize the ALTER in IDCAMS.

Code:
 ALTER      HLQ.TEMP.XYZ.DSN01.CTL   -               
   NEWNAME(HLQ.TEMP.ABC.DSN01.CTL)                   
IDC0531I ENTRY HLQ.TEMP.XYZ.DSN01.CTL ALTERED       
IDC0001I FUNCTION COMPLETED, HIGHEST CONDITION CODE WAS 0
                                                         
 ALTER      HLQ.TEMP.XYZ.DSN02.CTL   -               
   NEWNAME(HLQ.TEMP.ABC.DSN02.CTL)                   
IDC0531I ENTRY HLQ.TEMP.XYZ.DSN02.CTL ALTERED       
IDC0001I FUNCTION COMPLETED, HIGHEST CONDITION CODE WAS 0
                                                         
 ALTER      HLQ.TEMP.XYZ.DSN03.CTL   -               
   NEWNAME(HLQ.TEMP.ABC.DSN03.CTL)                   
IDC0531I ENTRY HLQ.TEMP.XYZ.DSN03.CTL ALTERED       
IDC0001I FUNCTION COMPLETED, HIGHEST CONDITION CODE WAS 0



However, when you're changing the HLQ, you need to be aware of restrictions and the behavior depending on whether the datasets are SMS managed or not. Read the ALTER parm section carefully in the Access Method Services manual if you decide to use the ALTER.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Oct 30, 2008 1:10 pm    Post subject: Reply with quote

jsharon1248,

I guess you misunderstood the requirement. OP has only one 1 input dataset which needs to be split into multiple files based on the city code

manasa wrote:
i have one input dataset with name like AC8.TXXX.INTERFCE.the input file first 3 digits contains the cty code like XXX ..we need to change XXX to AAA and we need to copy same file to diff dataset with name is like AC8.TAAA.INTERFCE

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jsharon1248
Intermediate


Joined: 08 Aug 2007
Posts: 291
Topics: 2
Location: Chicago

PostPosted: Thu Oct 30, 2008 2:03 pm    Post subject: Reply with quote

Yeah. I was way off. Sorry. Embarassed
Back to top
View user's profile Send private message
manasa
Beginner


Joined: 29 Oct 2008
Posts: 5
Topics: 1

PostPosted: Mon Nov 24, 2008 11:19 am    Post subject: Reply with quote

Hello Kolusu..

Thanks a ton.

Need one more help..i am able to change the CTY code in the header record by using your program.but only header record is copied in to the output file..but i need to copy all the records also

INPUT file:AC8.T999.INTERFCE

*********************************************************
999 000000122-10-200817:04:53
0000001 WINCOR NIXDORF REGISTER
0000002 WINCOR NIXDORF REGISTER
0000003 WINCOR NIXDORF CASH DRA
0000004 WINCOR NIXDORF CASH DRA
0000005 WINCOR NIXDORF CASH DRA
0000006 SIEMENS NIXDORF BANKING
0000007 SIEMENS NIXDORF REGISTER
************************************************************

Output File: AC8.618.INTERFCE

*********************************************************
618 000000122-10-200817:04:53
0000001 WINCOR NIXDORF REGISTER
0000002 WINCOR NIXDORF REGISTER
0000003 WINCOR NIXDORF CASH DRA
0000004 WINCOR NIXDORF CASH DRA
0000005 WINCOR NIXDORF CASH DRA
0000006 SIEMENS NIXDORF BANKING
0000007 SIEMENS NIXDORF REGISTER
************************************************************


Thanks you once again..
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon Nov 24, 2008 11:31 am    Post subject: Reply with quote

manasa,

Show me the control cards you used. The control cards I gave are splitting the input file based on the first 3 digits in the file. but looks like your input has one header with the code and the rest all detail records.

I am guessing that you have a file with many sets of group records.
Code:

City Group 1 header
detail record1
detail record2
detail record3
detail record4
detail record5
City Group 2 header
detail record1
detail record2
detail record3
City Group 3 header
detail record1
detail record2
...

So on and now you want to split them into different files along with the header , is that it?
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
manasa
Beginner


Joined: 29 Oct 2008
Posts: 5
Topics: 1

PostPosted: Mon Nov 24, 2008 11:38 am    Post subject: Reply with quote

kolusu

only one header record is that file.
INPUT file:AC8.T999.INTERFCE

Code:

999 000000122-10-200817:04:53  -- header record
0000001 WINCOR NIXDORF REGISTER  -- records
0000002 WINCOR NIXDORF REGISTER
0000003 WINCOR NIXDORF CASH DRA
0000004 WINCOR NIXDORF CASH DRA
0000005 WINCOR NIXDORF CASH DRA
0000006 SIEMENS NIXDORF BANKING
0000007 SIEMENS NIXDORF REGISTER

we need change the change the header record and copy the other records in to that file.
Back to top
View user's profile Send private message
manasa
Beginner


Joined: 29 Oct 2008
Posts: 5
Topics: 1

PostPosted: Mon Nov 24, 2008 11:39 am    Post subject: Reply with quote

kolusu,

yes you are correct.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon Nov 24, 2008 12:36 pm    Post subject: Reply with quote

manasa,

You can do this with the new WHEN=GROUP function of DFSORT available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008) like this:

Code:

//STEP0100 EXEC PGM=ICEMAN                                     
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD *                                               
999 000000122-10-200817:04:53  -- HEADER RECORD               
0000001 WINCOR  NIXDORF REGISTER                               
0000002 WINCOR  NIXDORF REGISTER                               
0000003 WINCOR  NIXDORF CASH DRA                               
0000004 WINCOR  NIXDORF CASH DRA                               
0000005 WINCOR  NIXDORF CASH DRA                               
0000006 SIEMENS NIXDORF BANKING                               
0000007 SIEMENS NIXDORF REGISTER                               
111 000000122-10-200817:04:53  -- HEADER RECORD               
0000001 DETAIL RECORD1                                         
0000002 DETAIL RECORD2                                         
0000003 DETAIL RECORD3                                         
0000004 DETAIL RECORD4                                         
0000005 DETAIL RECORD5                                         
222 000000122-10-200817:04:53  -- HEADER RECORD               
0000001 DETAIL RECORD1                                         
0000002 DETAIL RECORD2                                         
//CITY1    DD SYSOUT=*                                         
//CITY2    DD SYSOUT=*                                         
//CITY3    DD SYSOUT=*                                         
//SYSIN    DD *                                               
  SORT FIELDS=COPY                                             
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,ZD,NE,0),PUSH=(81:1,3)),
  IFTHEN=(WHEN=(1,3,CH,EQ,C'999'),OVERLAY=(1:C'618')),         
  IFTHEN=(WHEN=(1,3,CH,EQ,C'111'),OVERLAY=(1:C'619')),         
  IFTHEN=(WHEN=(1,3,CH,EQ,C'222'),OVERLAY=(1:C'620'))         
                                                               
  OUTFIL FNAMES=CITY1,BUILD=(1,80),INCLUDE=(81,3,CH,EQ,C'999')
  OUTFIL FNAMES=CITY2,BUILD=(1,80),INCLUDE=(81,3,CH,EQ,C'111')
  OUTFIL FNAMES=CITY3,BUILD=(1,80),INCLUDE=(81,3,CH,EQ,C'222')
/*


City1 will have
Code:

618 000000122-10-200817:04:53  -- HEADER RECORD   
0000001 WINCOR  NIXDORF REGISTER                 
0000002 WINCOR  NIXDORF REGISTER                 
0000003 WINCOR  NIXDORF CASH DRA                 
0000004 WINCOR  NIXDORF CASH DRA                 
0000005 WINCOR  NIXDORF CASH DRA                 
0000006 SIEMENS NIXDORF BANKING                   
0000007 SIEMENS NIXDORF REGISTER                 


city2 will have

Code:

619 000000122-10-200817:04:53  -- HEADER RECORD
0000001 DETAIL RECORD1                         
0000001 DETAIL RECORD2                         
0000001 DETAIL RECORD3                         
0000001 DETAIL RECORD4                         
0000001 DETAIL RECORD5                         


city3 will have
Code:

620 000000122-10-200817:04:53  -- HEADER RECORD
0000001 DETAIL RECORD1                         
0000001 DETAIL RECORD2                         



If you don't have the July, 2008 PTF installed, ask your System Programmer to install it (it's free).

For complete details on the new WHEN=GROUP and the other new functions available with PTF UK90013, see:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/

Hope this helps...

Cheers
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
manasa
Beginner


Joined: 29 Oct 2008
Posts: 5
Topics: 1

PostPosted: Tue Nov 25, 2008 5:23 am    Post subject: Reply with quote

kolusu,

i am getting syntax error.while using the When = Group condition..

Can you please provide me any other solution.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Nov 25, 2008 12:38 pm    Post subject: Reply with quote

manasa,

Run the following Job and show me your sysout, so that we can determine the function level of DFSORT.

Code:

//STEP0100 EXEC PGM=ICEMAN
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *
SAMPLE
//SORTOUT  DD DUMMY
//SYSIN    DD *
  OPTION COPY
/*

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group