Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to separeate data according to data length?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Wed Jun 24, 2009 10:19 am    Post subject: How to separeate data according to data length?
Reply with quote

Hi,

I want to separate data according to the length of the record.

Suppose I have the following input file:
Code:


=COLS> ----+----1----
****** **************
000001 A00001 A000   
000002 A00002   0002
000003 A00003 A0000 
000004 A00004  00004
000005 A00005 A00005
****** **************

The output will be like this:
file1 has data length of 4, from column 8 to column 14:
Code:

=COLS> ----+----1---
****** *************
000001 A00001 A000 
000002 A00002 0002 
****** *************

file2 has data length of 5, from column 8 to column 14:
Code:

=COLS> ----+----1----
****** **************
000001 A00003 A0000 
000002 A00004 00004 
****** **************

file3 has data length of 6, from column 8 to column 14:
Code:

=COLS> ----+----1----
****** **************
000001 A00005 A00005
****** **************


Would you please give me some suggestions?

Thanks in advance.[/code]
Back to top
View user's profile Send private message

Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed Jun 24, 2009 3:39 pm    Post subject:
Reply with quote

You can use below.. icon_smile.gif

Code:

//SORTIN   DD *                                                     
A00001 A000                                                         
A00002   0002                                                       
A00003 A0000                                                         
A00004  00004                                                       
A00005 A00005                                                       
/*                                                                   
//F1       DD SYSOUT=*                                               
//F2       DD SYSOUT=*                                               
//F3       DD SYSOUT=*                                               
//SYSIN    DD    *                                                   
  OPTION COPY                                                       
  INREC FIELDS=(1,7,8,7,SQZ=(SHIFT=LEFT))                           
  OUTFIL FNAMES=F1,INCLUDE=(12,3,CH,EQ,C'   ')                       
  OUTFIL FNAMES=F2,INCLUDE=(13,2,CH,EQ,C'  ',AND,12,1,CH,NE,C' ')   
  OUTFIL FNAMES=F3,SAVE                                             
/*                                                                   
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Wed Jun 24, 2009 6:55 pm    Post subject:
Reply with quote

Indeed, if the following statement is added to the above jcl, the expected result can come out.
Code:
//SORTOUT  DD DUMMY       


But I wonder if there is someway to count the number of data that is not blank?

In the above example, the number of data in each record that is not blank from column 8 to column 14 is:
F1: 4
F2: 5
F3: 6
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Jun 24, 2009 8:33 pm    Post subject:
Reply with quote

dejunzhu,

You don't need the SORTOUT statement at all when you have OUTFIL FNAMES. You can omit it instead of dummying it out.

The following DFSORT JCL will give you the desired results counting the non blank characters and put it in col 15

Code:

//STEP0100 EXEC PGM=SORT                                           
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD *                                                   
A00001 A000                                                       
A00002   0002                                                     
A00003 A0000                                                       
A00004  00004                                                     
A00005 A00005                                                     
//SORTOUT  DD SYSOUT=*                                             
//SYSIN    DD *                                                   
  SORT FIELDS=COPY                                                 
  INREC IFOUTLEN=15,                                               
  IFTHEN=(WHEN=INIT,OVERLAY=(15:6C'1')),                           
  IFTHEN=(WHEN=(08,1,CH,EQ,C' '),OVERLAY=(15:C'0'),HIT=NEXT),     
  IFTHEN=(WHEN=(09,1,CH,EQ,C' '),OVERLAY=(16:C'0'),HIT=NEXT),     
  IFTHEN=(WHEN=(10,1,CH,EQ,C' '),OVERLAY=(17:C'0'),HIT=NEXT),     
  IFTHEN=(WHEN=(11,1,CH,EQ,C' '),OVERLAY=(18:C'0'),HIT=NEXT),     
  IFTHEN=(WHEN=(12,1,CH,EQ,C' '),OVERLAY=(19:C'0'),HIT=NEXT),     
  IFTHEN=(WHEN=(13,1,CH,EQ,C' '),OVERLAY=(20:C'0'),HIT=NEXT),     
  IFTHEN=(WHEN=(14,1,CH,EQ,C' '),OVERLAY=(21:C'0'),HIT=NEXT),     
  IFTHEN=(WHEN=ANY,OVERLAY=(15:15,1,ZD,ADD,16,1,ZD,ADD,17,1,ZD,ADD,
                   18,1,ZD,ADD,19,1,ZD,ADD,20,1,ZD,EDIT=(T)))     
/*


The output will be
Code:

A00001 A000   4
A00002   0002 4
A00003 A0000  5
A00004  00004 5
A00005 A00005 6
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Wed Jun 24, 2009 8:42 pm    Post subject:
Reply with quote

Hi, Skolusu,

Thanks for your kind help.
The JCL you gave proved to be effective.

Thanks again.
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 Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
No new posts Fetching data from JHS as per the cur... arunsoods All Other Mainframe Topics 4 Wed Nov 22, 2017 1:54 pm
No new posts Extract Record using range of Data scorp_rahul23 DFSORT/ICETOOL 3 Wed Nov 15, 2017 11:54 pm
No new posts Updating data from one file to other!!! Vignesh Sid SYNCSORT 1 Mon Nov 06, 2017 2:42 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us