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

Sorting and writing to different files


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
prav_06
Warnings : 1

Active User


Joined: 13 Dec 2005
Posts: 154
Location: The Netherlands

PostPosted: Mon Oct 12, 2009 11:31 am
Reply with quote

Dear All,
I have a requirement , there is a flat file in which I have records as given below

Code:
1000XXX9999
2000XXX8888
2000XXX7777
2000XXX6666
1000XXX8888
2000XXX5555
2000XXX4444
2000XXX3333
1000XXX7777
2000XXX5555
2000XXX4444
2000XXX3333
.
.
.
1000XXX6666
.
.
.
.
2000XXX2222


My reqiurement is to split these recrods as given below

Code:
1000XXX9999
2000XXX8888
2000XXX7777
2000XXX6666 ---> Goes to file # 1



Code:
1000XXX8888
2000XXX5555
2000XXX4444
2000XXX3333 ----> Goes to File # 2


and so on, there can be maximum of 5 set of such records which are to be copied to 5 diff files.

Can this be done by Sort or ICETOOL, please let me know

Regards,
Thamilzan.
Back to top
View user's profile Send private message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 184
Location: India

PostPosted: Mon Oct 12, 2009 12:27 pm
Reply with quote

Hi,

Requirements are not clear! How the records/rows are decided to move to different files. Please let us know on which condition you are deciding the file to move certain records.

If you explain the requirement clearly then someone will give you a solution.
Back to top
View user's profile Send private message
prav_06
Warnings : 1

Active User


Joined: 13 Dec 2005
Posts: 154
Location: The Netherlands

PostPosted: Mon Oct 12, 2009 12:46 pm
Reply with quote

Dear All,

The records are bifuracteed by the occurance of 1 in the records ,

Code:
1000XXX9999
2000XXX8888
2000XXX7777
2000XXX6666
1000XXX8888
2000XXX5555
2000XXX4444
2000XXX3333
1000XXX7777
2000XXX5555
2000XXX4444
2000XXX3333
.
.
.
1000XXX6666
.
.
.
.
2000XXX2222


In the above set ,

Code:
1000XXX9999
2000XXX8888
2000XXX7777
2000XXX6666 ---> Considered as first set


Code:
1000XXX8888
2000XXX5555
2000XXX4444
2000XXX3333 ----> considered as second set


the occurance of 1 is the cond. in which the files has to be split.

Let me know in case of more information.

Regards,
Thamilzan.
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: Mon Oct 12, 2009 8:52 pm
Reply with quote

Thamilzan,

You can use a DFSORT job like the following to do what you asked for. 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)
//OUT1 DD DSN=...  output file1 (FB/80)
//OUT2 DD DSN=...  output file2 (FB/80)
//OUT3 DD DSN=...  output file3 (FB/80)
//OUT4 DD DSN=...  output file4 (FB/80)
//OUT5 DD DSN=...  output file5 (FB/80)
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'1'),PUSH=(81:ID=1))
  OUTFIL FNAMES=OUT1,INCLUDE=(81,1,CH,EQ,C'1'),BUILD=(1,80)
  OUTFIL FNAMES=OUT2,INCLUDE=(81,1,CH,EQ,C'2'),BUILD=(1,80)
  OUTFIL FNAMES=OUT3,INCLUDE=(81,1,CH,EQ,C'3'),BUILD=(1,80)
  OUTFIL FNAMES=OUT4,INCLUDE=(81,1,CH,EQ,C'4'),BUILD=(1,80)
  OUTFIL FNAMES=OUT5,INCLUDE=(81,1,CH,EQ,C'5'),BUILD=(1,80)
/*
Back to top
View user's profile Send private message
prav_06
Warnings : 1

Active User


Joined: 13 Dec 2005
Posts: 154
Location: The Netherlands

PostPosted: Tue Oct 13, 2009 1:01 pm
Reply with quote

Hi Frank,
Thanks for the quick reply, I tried the above my DS is lrecl 296, am getting a ABEND S000 U0016, below is my SYSOUT and JCL


Code:
SYSIN :                                                                       
 SORT FIELDS=COPY                                                             
 INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'1'),PUSH=(297:ID=1))             
                    *                                                         
 OUTFIL FNAMES=OUT1,INCLUDE=(81,1,CH,EQ,C'1'),BUILD=(1,296)                   
 OUTFIL FNAMES=OUT2,INCLUDE=(81,1,CH,EQ,C'2'),BUILD=(1,296)                   
WER903I  SYNCSORT 1.3.1.1 IS NOT LICENSED FOR SERIAL 88C0F, TYPE 2094 734, LPAR
WER903I  PRODUCT WILL STOP WORKING IN  36 DAYS UNLESS A VALID KEY IS INSTALLED.
WER268A  INREC STATEMENT   : SYNTAX ERROR                                     
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                                 
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                                 



Code:
//STEP01 EXEC PGM=SORT                       
//SYSOUT    DD  SYSOUT=*                     
//SORTIN DD DSN=ZJ00.LOG.FILE.PY726,DISP=SHR  -->I/p
//OUT1 DD DSN=ZJ00.LOG.FILE.xxx6.OU1,DISP=SHR -->o/p1
//OUT2 DD DSN=ZJ00.LOG.FILE.xxx7.OU2,DISP=SHR ---> o/p2
//SYSIN DD *
 OPTION COPY                                                     
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'1'),PUSH=(297:ID=1))                                             
OUTFIL FNAMES=OUT1,INCLUDE=(81,1,CH,EQ,C'1'),BUILD=(1,296)       
OUTFIL FNAMES=OUT2,INCLUDE=(81,1,CH,EQ,C'2'),BUILD=(1,296)       
/*


Regards,
Thamilzan.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Oct 13, 2009 1:26 pm
Reply with quote

Thamilzan,

you are using SYNCSORT. Frank provides solutions to DFSORT.

Also, whatever SYNCSORT solution you use, it will be useless in 36 days
unless your bean-counters pay the bills.
Back to top
View user's profile Send private message
prav_06
Warnings : 1

Active User


Joined: 13 Dec 2005
Posts: 154
Location: The Netherlands

PostPosted: Tue Oct 13, 2009 2:38 pm
Reply with quote

Dear Brenholtz,

Is there a solution for this using SYNCSORT for the above request. Writing a COBOL prog. or an EzTrive is simpler I guess. Please let me know your thoughts.

Regards,
Thamilzan.
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: Tue Oct 13, 2009 8:07 pm
Reply with quote

Hello,

Quote:
Is there a solution for this using SYNCSORT for the above request.
The current release of Syncsort will do this. . .

As was mentioned, the Syncsort currently in use is about to "time-out". . .

When the license is upgraded, make sure the current release is also installed. . .
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
This topic is locked: you cannot edit posts or make replies. Automation need help in sorting the data DFSORT/ICETOOL 38
Search our Forums:

Back to Top