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

Moving data from one record to other record


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vpr_118
Warnings : 1

New User


Joined: 07 Apr 2008
Posts: 64
Location: chennai

PostPosted: Tue Aug 26, 2008 11:56 am
Reply with quote

Hi,

Please find the requirment below.

I have a file as below
1< some data >...YYMMDD...<some data>
5<............some data.................> ...YYMMDD

Now i have to change the YYMMDD in record starting with 5 must be same as YYMMDD of record starting from 1.

Say YYMMDD is 080722 for record starting with 1
same must be in record starting with 5

For record 1 YYMMDD starts at 24th position
and for record 5 it starts at 70 th position

The file is of lrecl=94

Can it be done using sort
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue Aug 26, 2008 12:00 pm
Reply with quote

Which sort product are you using ?
DFSORT or SYNCSORT or even CA-SORT
Back to top
View user's profile Send private message
vpr_118
Warnings : 1

New User


Joined: 07 Apr 2008
Posts: 64
Location: chennai

PostPosted: Tue Aug 26, 2008 12:06 pm
Reply with quote

I am using DFSORT.

Please let me know if we can get a data from a particular record starting with '1' and place it to another record starting with 5 from particular position.
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Tue Aug 26, 2008 12:13 pm
Reply with quote

VPR,

Check this JCl for your reqt

Code:
//S1       EXEC PGM=ICEMAN                                       
//SYSOUT   DD SYSOUT=*                                           
//SORTIN   DD *                                                 
1ABCDEFGHIJKLMNOPQRSTUV080722ABCDEF                             
5AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYYMMDD         
/*                                                               
//SORTOUT  DD DSN=&&W2,DISP=(,PASS),                             
//             SPACE=(TRK,(1,1)),UNIT=SYSDA                     
//SYSIN    DD *                                                 
  OPTION COPY,STOPAFT=1                                         
* CREATE DFSORT SYMBOL AS:                                       
* MYDATE,'YYMMDD'                                               
  OUTREC FIELDS=(C'TESTDT,''',24,6,C'''',80:X)                   
/*                                                               
//*                                                             
//S2       EXEC PGM=ICEMAN                                       
//SYSOUT   DD SYSOUT=*                                           
//SYMNAMES DD DSN=&&W2,DISP=(OLD,PASS)                           
//SORTIN   DD *                                                 
1ABCDEFGHIJKLMNOPQRSTUV080722ABCDEF                             
5AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYYMMDD         
/*                                                               
//SORTOUT  DD SYSOUT=*                                           
//SYSIN    DD *                                                 
  OPTION COPY                                                   
* USE TESTDT TO OVERLAY OLD DATE.                               
  INREC IFTHEN=(WHEN=(1,1,CH,EQ,C'5'),                           
        OVERLAY=(50:TESTDT))                                     
/*                                                               



Output:

Code:
1ABCDEFGHIJKLMNOPQRSTUV080722ABCDEF                     
5AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA080722


Change 50 to 70 and test. I have assumed the position as 50 for my testting.
Back to top
View user's profile Send private message
vpr_118
Warnings : 1

New User


Joined: 07 Apr 2008
Posts: 64
Location: chennai

PostPosted: Tue Aug 26, 2008 12:52 pm
Reply with quote

Thanks for your reply.
Can it be done using PGM=SORT.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Aug 26, 2008 12:54 pm
Reply with quote

Quote:
Can it be done using PGM=SORT

Yes

Thanks,
Arun
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Tue Aug 26, 2008 12:59 pm
Reply with quote

Vpr,

Quote:
Thanks for your reply. Can it be done using PGM=SORT.


Yes.

DFSORT can be invoked directly either by using PGM=SORT or PGM=ICEMAN.

Change, test and let us know if it works.
Back to top
View user's profile Send private message
vpr_118
Warnings : 1

New User


Joined: 07 Apr 2008
Posts: 64
Location: chennai

PostPosted: Tue Aug 26, 2008 1:18 pm
Reply with quote

I did a test run using the jcl given by you. It ended with S013.


Code:

//SYSOUT   DD SYSOUT=*                                           
//SYSPRINT DD SYSOUT=*                                           
//SORTIN      DD DSN=<INPUT FILE>,DISP=SHR
//SORTOUT     DD DSN=&&TEMP,                                     
//            SPACE=(CYL,(1,1),RLSE),                             
//            DISP=(NEW,PASS)                                     
//SYSIN    DD *                                                   
  OPTION COPY,STOPAFT=1                                           
  OUTREC FIELDS=(C'TESTDT,''',24,6,C'''',94:X)                   
/*                                                               
//S2       EXEC PGM=ICEMAN                                       
//SYSOUT   DD SYSOUT=*                                           
//SYMNAMES DD DSN=&&TEMP,DISP=(OLD,PASS)                         
//SORTIN   DD  DSN=<INPUT FILE>,DISP=SHR   
//SORTOUT  DD DSN=<OUTPUT FILE>,           
//            DISP=(NEW,CATLG,DELETE),                           
//            DCB=D04BT.ECSUS.SYMP3.BPC10508.WEBRTURN,           
//            SPACE=(CYL,(25,25),RLSE)                           
//SYSIN    DD *                                                   
  OPTION COPY                                                     
  INREC IFTHEN=(WHEN=(1,1,CH,EQ,C'5'),                           
               OVERLAY=(70:TESTDT))                               
/*     


S013:

Code:

ICE751I 2 C5-K26318 DA-K28804                               
ICE185A 0 AN S013  ABEND WAS ISSUED BY DFSORT, ANOTHER PROGRAM OR AN EXIT (PHASE   0)
Back to top
View user's profile Send private message
vpr_118
Warnings : 1

New User


Joined: 07 Apr 2008
Posts: 64
Location: chennai

PostPosted: Tue Aug 26, 2008 1:31 pm
Reply with quote

Thanks Aru,

I got the culprit.

I am able to run the job using PGM=SORT.
Please find the job below

Code:

//****************************************************           
//* JCL INSERT A FIELD IN A PARTICULAR POSITION*******           
//S1       EXEC PGM=SORT                                         
//SYSOUT   DD SYSOUT=*                                           
//SYSPRINT DD SYSOUT=*                                           
//SORTIN      DD DSN=<...INPUT FILE...>,DISP=SHR
//SORTOUT     DD DSN=&&TEMP,                                     
//            SPACE=(CYL,(1,1),RLSE),                             
//            DISP=(NEW,PASS)                                     
//SYSIN    DD *                                                   
  OPTION COPY,STOPAFT=1                                           
  OUTREC FIELDS=(C'TESTDT,''',24,6,C'''',80:X)                   
/*                                                               
//S2       EXEC PGM=SORT                                         
//SYSOUT   DD SYSOUT=*                                           
//SYMNAMES DD DSN=&&TEMP,DISP=(OLD,PASS)                         
//SORTIN   DD DSN=<...INPUT FILE...>,DISP=SHR
//SORTOUT  DD DSN=<...OUTPUT FILE...>,
//            DISP=(NEW,CATLG,DELETE),                           
//            DCB=<...INPUT FILE....>,
//            SPACE=(CYL,(25,25),RLSE)                           
//SYSIN    DD *                                                   
  OPTION COPY                                                     
  INREC IFTHEN=(WHEN=(1,1,CH,EQ,C'5'),                           
               OVERLAY=(70:9,6))                                 
/*     


Can it be done in a single step.
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Tue Aug 26, 2008 1:53 pm
Reply with quote

Vpr,

Quote:
I did a test run using the jcl given by you. It ended with S013.


It is because of the below statement in your JCL.

Code:
OUTREC FIELDS=(C'TESTDT,''',24,6,C'''',94:X)


From where did you get 94 when i had mentioned 80 in my JCL?? SYMNAMES dataset record length should be 80. Change it to 80 and check, it would work.

Quote:
Can it be done in a single step.


As far as i know, it is difficult to do this in one step. Wait for Frank for a better solution in a single step.

Please use the code tag while posting the code. Check this

http://ibmmainframes.com/faq.php?mode=bbcode

Moderators,

Please move this topic to the DFSORT forum.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Aug 26, 2008 9:05 pm
Reply with quote

Vpr,

The job Aaru gave you only reads one record in the first step so what's the problem with using two steps?

However, if you have z/OS DFSORT V1R5 PTF UK90013 (July, 2008), you can use the new WHEN=GROUP function to do this in one pass. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/80)
//SORTOUT DD DSN=...  output file (FB/80)
//SYSIN    DD    *
  OPTION COPY
  INREC IFOUTLEN=80,
    IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'1'),PUSH=(81:24,6)),
    IFTHEN=(WHEN=(1,1,CH,EQ,C'5'),OVERLAY=(70:81,6))
/*


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

Use [URL] BBCode for External Links
Back to top
View user's profile Send private message
vpr_118
Warnings : 1

New User


Joined: 07 Apr 2008
Posts: 64
Location: chennai

PostPosted: Wed Aug 27, 2008 11:57 am
Reply with quote

The link is really very informative.

Why i need to do it one step?

Aim is to reduce the number of steps and there by number of lines in jcl as far as possible.

The jcl give by you also worked.
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Wed Aug 27, 2008 12:02 pm
Reply with quote

Vpr,

Quote:
Why i need to do it one step?


You should only answer.

Hope you finally got what you wanted.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Aug 27, 2008 9:03 pm
Reply with quote

Quote:
Aim is to reduce the number of steps and there by number of lines in jcl as far as possible.


Hmmm ... I can't imagine why a few extra lines of JCL would matter in any significant way, but ok. (You must have some "extreme" beancounters in your shop.)

Quote:
The jcl give by you also worked.


Good.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Aug 27, 2008 9:18 pm
Reply with quote

Hello,

Quote:
Aim is to reduce the number of steps and there by number of lines in jcl as far as possible.
Why?

What business or technical reason might there be for this?

It is far better to implement processes that run correctly, use minimum system resources, and are easily understood and maintained. To sacrifice any of those requirements to save a few lines of jcl or another step does the system and the organization a great disservice.
Back to top
View user's profile Send private message
vpr_118
Warnings : 1

New User


Joined: 07 Apr 2008
Posts: 64
Location: chennai

PostPosted: Thu Aug 28, 2008 11:16 am
Reply with quote

Hi,

Suggestions and advice well taken.

Will make sure to keep all these in mind and implement the same.

Thanks all..
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 How to split large record length file... DFSORT/ICETOOL 7
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts To find whether record count are true... DFSORT/ICETOOL 6
Search our Forums:

Back to Top