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

modifying set of records and writing into a single file


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

New User


Joined: 06 Jul 2012
Posts: 43
Location: INDIA

PostPosted: Thu Jan 09, 2014 12:39 pm
Reply with quote

Hi,

I've a file with some hundreds of records which are sorted based on some key fields.

Now, I need to edit a key field in all these records say first 200 records should have the value 123. Next 100 records should have 124. next 300 records to have value 125 and so on for 5 times in overall. And all these modified records have to be in the same output file.

As of now, i'm trying OUTFIL & SKIPREC,STOPAFT combination and writing into 5 different files and finally merging into a single file.

Is it possible to avoid this OUTFIL option/multiple files and do a SORT Operation directly to move into a single output file ???
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Jan 09, 2014 1:10 pm
Reply with quote

Extend each record to include a sequence number (varaible-length or fixed-length records dictate where to do the extension).

Use IFTHEN=(WHEN=INIT to set the SEQNUM with a RESTART on itself for the number of records you want in a group of records.

Use IFTHEN=(WHEN=GROUP with BEGIN for sequence zero and RECORDS= for the number in your group and PUSH an ID into where you want the data to be the same for each group.

Use IFTHEN=(WHEN=INIT to add 122 to your entire field which needs to change.

Please post your code once you have it working.

To develop the solution, add one piece at a time to a basic COPY operation. Once you are clear about what that does and that it is working, move on to the next.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Thu Jan 09, 2014 2:44 pm
Reply with quote

Bill,

I havent tried it ..

But cant we have the option START and have the SEQNUM start at 123.So there by we can avoid the below

Quote:
Use IFTHEN=(WHEN=INIT to add 122 to your entire field which needs to change.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Jan 09, 2014 3:30 pm
Reply with quote

Yes, good point.
Back to top
View user's profile Send private message
dsivapradeep

New User


Joined: 06 Jul 2012
Posts: 43
Location: INDIA

PostPosted: Thu Jan 09, 2014 3:37 pm
Reply with quote

Thanks Bill,

I followed little different procedure for the 3rd IFTHEN.

Below is sort card. Input file is 80 bytes length.
Code:

//SYSIN DD *
  SORT FIELDS=COPY
  INREC IFTHEN=(WHEN=INT,
   BUILD=(1:1,80,81:SEQNUM,4,ZD,START=1,INCR=1,RESTART=(81,4))),
   IFTHEN=(WHEN=GROUP,BEGIN=(81,4,ZD,EQ,0001),
     END=(81,4,ZD,EQ,0003),PUSH=(90:ID=1)),
   IFTHEN=(WHEN=GROUP,BEGIN=(81,4,ZD,EQ,0004),
     END=(81,4,ZD,EQ,0005),PUSH=(90:ID=2)),
   IFTHEN=(WHEN=GROUP,BEGIN=(81,4,ZD,EQ,0006),
     END=(81,4,ZD,EQ,0007),PUSH=(90:ID=3)),
   IFTHEN=(WHEN=(90,1,CH,EQ,C'1'),BUILD=(C'123',4:4,77),
   IFTHEN=(WHEN=(90,1,CH,EQ,C'01'),BUILD=(C'124',4:4,77),
   IFTHEN=(WHEN=(90,1,CH,EQ,C'001'),BUILD=(C'125',4:4,77)
/*


Input file looks like this.
Code:

10001 A*****
12001 A*****
11001 A*****
14001 A*****
15001 A*****
1F001 A*****
1H001 A*****


Expected & Obtained output is :
Code:

123***
123***
123***
124***
124***
125***
125***


This is dummy data input file.. I think I can use this data card for my actual file also.
Back to top
View user's profile Send private message
sureshpathi10

Active User


Joined: 03 May 2010
Posts: 154
Location: Kuala Lumpur

PostPosted: Fri Jan 10, 2014 8:23 am
Reply with quote

You may try this as well.

Code:

//SYSIN    DD *                                             
  INREC IFTHEN=(WHEN=INIT,BUILD=(1:1,80,81:SEQNUM,4,ZD)),   
        IFTHEN=(WHEN=(81,4,ZD,LE,5),BUILD=(C'123',4:4,77)),
        IFTHEN=(WHEN=(81,4,ZD,GT,5,AND,81,4,ZD,LE,10),     
                BUILD=(C'124',4:4,77)),                     
        IFTHEN=(WHEN=(81,4,ZD,GT,10,AND,81,4,ZD,LE,15),     
                BUILD=(C'125',4:4,77)),                     
        IFTHEN=(WHEN=(81,4,ZD,GT,15),BUILD=(C'126',4:4,77))
  SORT FIELDS=COPY                                         


INPUT:
Code:

AAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAA


OUTPUT:
Code:

123AAAAAAAAAAAAAAAAAAAAA
123AAAAAAAAAAAAAAAAAAAAA
123AAAAAAAAAAAAAAAAAAAAA
123AAAAAAAAAAAAAAAAAAAAA
123AAAAAAAAAAAAAAAAAAAAA
124AAAAAAAAAAAAAAAAAAAAA
124AAAAAAAAAAAAAAAAAAAAA
124AAAAAAAAAAAAAAAAAAAAA
124AAAAAAAAAAAAAAAAAAAAA
124AAAAAAAAAAAAAAAAAAAAA
125AAAAAAAAAAAAAAAAAAAAA
125AAAAAAAAAAAAAAAAAAAAA
125AAAAAAAAAAAAAAAAAAAAA
125AAAAAAAAAAAAAAAAAAAAA
125AAAAAAAAAAAAAAAAAAAAA
126AAAAAAAAAAAAAAAAAAAAA
126AAAAAAAAAAAAAAAAAAAAA
126AAAAAAAAAAAAAAAAAAAAA
126AAAAAAAAAAAAAAAAAAAAA
126AAAAAAAAAAAAAAAAAAAAA
126AAAAAAAAAAAAAAAAAAAAA
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 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top