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
 

 

Sorting and writing to different files

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Sorting and writing to different files
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: 158
Location: India

PostPosted: Mon Oct 12, 2009 12:27 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Mon Oct 12, 2009 8:52 pm    Post subject:
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    Post subject:
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: 6968
Location: porcelain throne

PostPosted: Tue Oct 13, 2009 1:26 pm    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Tue Oct 13, 2009 8:07 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm
No new posts getting three output files out of JOI... migusd SYNCSORT 7 Mon Jun 05, 2017 11:30 pm
No new posts Sorting of hex values Saurabh_mi DFSORT/ICETOOL 11 Thu May 25, 2017 3:49 pm
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm


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