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
 

 

modifying set of records and writing into a single file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: modifying set of records and writing into a single file
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Jan 09, 2014 1:10 pm    Post subject: Reply to: modifying set of records and writing into a single
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

Moderator


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

PostPosted: Thu Jan 09, 2014 2:44 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Jan 09, 2014 3:30 pm    Post subject: Reply to: modifying set of records and writing into a single
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    Post subject:
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    Post subject:
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    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 Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


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