COPY DATA FROM FILE 1 TO FILE2 with many modifications



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

COPY DATA FROM FILE 1 TO FILE2 with many modifications

Postby hariharan_bk » Thu Aug 06, 2015 7:58 pm

Hi,

I m doing a file copy from one file1 to file2 and there involves some modifications which need to be done before copy.

FILE1:
123456789,SB,61,99.99,0.0,ABCD
123123123,AP,77,00.00,1.1,UVWX

OUTPUT FILE:
123456789,SETUPBOX,A,100,ABCD
123123123,AIRPLANE,B,200,UVWX

REQUIREMENT:
------------------
First field have to be copied as is. (123456789)

in the second field, If input file is SB, then we need to expand it to SETUPBOX.. else if it is AP, we need to expand it to AIRPLANE in the output field

In the third field, if 61 is there, then we need to change it to A.... if not, then change it B in the output field

In the fourth field is non-zero, we need to populate 100, else we need to send 200 in the output field

Last field have to be copied as is.
Many Thanks,
Harry
hariharan_bk
 
Posts: 70
Joined: Thu Mar 29, 2012 11:13 am
Has thanked: 5 times
Been thanked: 0 time

Re: COPY DATA FROM FILE 1 TO FILE2 with many modifications

 

Re: COPY DATA FROM FILE 1 TO FILE2 with many modifications

Postby enrico-sorichetti » Fri Aug 07, 2015 2:12 am

one/many modification is just a typing issues

what happened when You searched the forum ???

similar requirements have been discussed gazillions of times,
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2643
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 130 times

Re: COPY DATA FROM FILE 1 TO FILE2 with many modifications

Postby hariharan_bk » Fri Aug 07, 2015 3:37 pm

Requirement s like this:

I have used ICETOOL.

INPUT FILE:
Y3213214321SB61ABCDABXXXXXXX012345678910/10/2010
N3213214321GP62ABCDABXXXXXXX098765432110/10/2010
OUTPUT FILE:
Y3213214321SILVERBOX MABCDABXXXXXXX10/10/2010
N0987654321GLOBALPLAYAABCDABXXXXXXX10/10/2010

Requirements:
if the first char, is Y, then leave as is. If it is N, then replace chars (2-11) from 28-37
if the 11th and 12th chars are SB, replace them with 'SIVERBOX', else if GP, replace with 'GLOBALPLAY'
if the 13th and 14th chars are 61, then replace with M, else replace with A.

ALL there replacements can be done at a single shot? I have tried using multiple COPY TOOLIN statements and achieved this.

but required n single shot. Is that possible?


COPY FROM(TMP2) TO(TMP3) USING(CTL2)
COPY FROM(TMP3) TO(TMP4) USING(CTL3)
COPY FROM(TMP4) TO(TMP5) USING(CTL4)

//CTL2CNTL DD *
   OPTION COPY
   INREC  IFTHEN=(WHEN=(73,2,CH,EQ,C'SB'), OVERLAY=(73:C'SILVERBOX')),
         IFTHEN=(WHEN=(73,2,CH,EQ,C'GP'), OVERLAY=(73:C'GLOBAL PLAY'))
/*
//CTL3CNTL DD *
   OPTION COPY
   INREC IFTHEN=(WHEN=(93,2,BI,EQ,61),  OVERLAY=(93:C'M')),
         IFTHEN=(WHEN=(93,2,BI,NE,61), OVERLAY=(93:C'A'))
/*
//CTL4CNTL DD *
   OPTION COPY
  INREC  IFTHEN=(WHEN=(62,1,CH,EQ,C'Y'), OVERLAY=(63:63,10)),
         IFTHEN=(WHEN=(62,1,CH,EQ,C'N'), OVERLAY=(63:105,10))



Can all these IF statements in all these 3 ctrl cards can be put into one and achieve this? I have tried but the CTL3 logic and CTL4 logic are not working if put together under one ctl card.

Please advise.
Many Thanks,
Harry
hariharan_bk
 
Posts: 70
Joined: Thu Mar 29, 2012 11:13 am
Has thanked: 5 times
Been thanked: 0 time

Re: COPY DATA FROM FILE 1 TO FILE2 with many modifications

Postby BillyBoyo » Fri Aug 07, 2015 4:36 pm

Yes, they can all go in one SORT execution.

IFTHEN=(WHEN=(logigalprocessing) stops when a test it true (a sequence of IFTHEN=(WHEN=(logicalexpression) is like COBOL's EVALUATE, if you know COBOL).

To modify that behaviour, you add HIT=NEXT after the condition. Then each true test with a HIT=NEXT will continue to another true test.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: COPY DATA FROM FILE 1 TO FILE2 with many modifications

Postby hariharan_bk » Fri Aug 07, 2015 8:14 pm

Yes I am aware of the COBOL "Evaluate".. Actually I m changing multiple if statements / Evaluate from cobol to JCL. :)

Thanks .. Will try that option of HIT=NEXT
Many Thanks,
Harry
hariharan_bk
 
Posts: 70
Joined: Thu Mar 29, 2012 11:13 am
Has thanked: 5 times
Been thanked: 0 time

Re: COPY DATA FROM FILE 1 TO FILE2 with many modifications

Postby hariharan_bk » Fri Aug 07, 2015 8:44 pm

Input record: .......(72 chars)..BA61.....

the chars - BA is at 73 position, which wil get overlaid as DADDYMOMMY and chars 61 is at 75 position.

so here how should I consider the position of 61? is it after overlay of previous IF statements or based on the above input rec positions? Please advise.


INREC  IFTHEN=(WHEN=(73,2,CH,EQ,C'BA'),                             
                      OVERLAY=(73:C'DADDYMOMMY'),HIT=NEXT),           
      IFTHEN=(WHEN=(73,2,CH,EQ,C'GP'),                               
                      OVERLAY=(73:C'GLOBAL PLAY'),HIT=NEXT),       
            IFTHEN=(WHEN=(75,2,BI,EQ,61),                                 
                      OVERLAY=(93:C'A'),HIT=NEXT),                   
      IFTHEN=(WHEN=(75,2,BI,NE,61),                                 
                      OVERLAY=(93:C'M'))                             


Above dint give the expected result.
Many Thanks,
Harry
hariharan_bk
 
Posts: 70
Joined: Thu Mar 29, 2012 11:13 am
Has thanked: 5 times
Been thanked: 0 time

Re: COPY DATA FROM FILE 1 TO FILE2 with many modifications

Postby BillyBoyo » Fri Aug 07, 2015 10:57 pm

If position 75 was a two-byte binary with a value of 61, you will splatter it if BA and GP values are not mutually exclusive with that. But, if they were, you wouldn't need the HIT=NEXT, so you'd best explain why putting DADDYMOMMY at 73 wont make 75 C'DD', which in a two-byte binary is 50372.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: COPY DATA FROM FILE 1 TO FILE2 with many modifications

Postby NicC » Sat Aug 08, 2015 2:57 am

Actually I m changing multiple if statements / Evaluate from cobol to JCL

Why do you insist on calling sort control cards JCL? They are not, they are sort control cards. You will not find them in the JCL manual but in the sort manual for your sort product,
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: COPY DATA FROM FILE 1 TO FILE2 with many modifications

Postby hariharan_bk » Mon Aug 10, 2015 5:16 pm

Sorry NicC. I didnt follow you. Please help me understand.
Many Thanks,
Harry
hariharan_bk
 
Posts: 70
Joined: Thu Mar 29, 2012 11:13 am
Has thanked: 5 times
Been thanked: 0 time

Re: COPY DATA FROM FILE 1 TO FILE2 with many modifications

Postby BillyBoyo » Mon Aug 10, 2015 5:31 pm

If you look at a JCL Reference manual, you'll find everything which is JCL.

If you look at (in your case) a SyncSORT manual (it is actually MFX, for Mainframe Express, but it takes us a while to catch onto a name-change like that) you'll find everything which is SORT Control Cards.

Although you need JCL to run SORT, it is the SORT Control Cards which are doing the work, not the JCL.

It is very common for SORT Control Cards to be referred to as JCL. However, that does not detract from the point that if you don't know what you are talking about (the terminology, used accurately), you probably will have errors of understanding.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Next

Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post