Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Moving data from one record to other record

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Moving data from one record to other record
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: 8593
Location: Back in jolly old England

PostPosted: Tue Aug 26, 2008 12:00 pm    Post subject:
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    Post subject: Reply to: Moving data from one record to other record
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: 1288
Location: Chennai, India

PostPosted: Tue Aug 26, 2008 12:13 pm    Post subject: Reply to: Moving data from one record to other record
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    Post subject: Reply to: Moving data from one record to other record
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: 2165
Location: @my desk

PostPosted: Tue Aug 26, 2008 12:54 pm    Post subject:
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: 1288
Location: Chennai, India

PostPosted: Tue Aug 26, 2008 12:59 pm    Post subject: Reply to: Moving data from one record to other record
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    Post subject: Reply to: Moving data from one record to other record
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    Post subject: Reply to: Moving data from one record to other record
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: 1288
Location: Chennai, India

PostPosted: Tue Aug 26, 2008 1:53 pm    Post subject: Reply to: Moving data from one record to other record
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 Moderator


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

PostPosted: Tue Aug 26, 2008 9:05 pm    Post subject:
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:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/
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    Post subject: Reply to: Moving data from one record to other record
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: 1288
Location: Chennai, India

PostPosted: Wed Aug 27, 2008 12:02 pm    Post subject: Reply to: Moving data from one record to other record
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 Moderator


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

PostPosted: Wed Aug 27, 2008 9:03 pm    Post subject:
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

Site Director


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

PostPosted: Wed Aug 27, 2008 9:18 pm    Post subject:
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    Post subject: Reply to: Moving data from one record to other record
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Is the 'prompt' data for the DSLIST p... Willy Jensen TSO/ISPF 2 Tue Dec 06, 2016 4:38 am
This topic is locked: you cannot edit posts or make replies. How to move a long alphanumeric data ... lind sh COBOL Programming 8 Mon Dec 05, 2016 7:51 pm
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts ODPP(Optim Data privacy Provider) Iss... Rama kishore IBM Tools 1 Mon Nov 07, 2016 5:46 pm
No new posts Can sending 5 MB data between cobol p... Kevin Vaz CICS 12 Tue Oct 18, 2016 4:50 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us