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 arrive at this File using SORT

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

New User


Joined: 27 Jul 2005
Posts: 35
Location: Chennai

PostPosted: Sat Jan 20, 2007 5:54 pm    Post subject: How to arrive at this File using SORT
Reply with quote

Hi,
I have an input file which has 6 fields in the below format

Code:

Field 1   field 2      field 3    Field 4    Field 5           Field 6
01        8305810257   19871020   051400727  8 561 8659/       85618659
01        8724011641   19870828   051400727  8 517 0534/       85170534
01        8724011641   19870828   051400727  85170534          85170534
01        8724011641   19870828   051400727  85170535          85170535
01        8724011641   19870828   051400727  123456             123456
01        8724011641   19870828   051400727  651705-35         65170535
01        8724011641   19870828   051400727  6517/05-35        65170535
01        8724011641   19870828   051400727  6517053/5         65170535
01        8724011641   19870828   051400727  11111               11111



My output file should contain only records which has non-numeric value in Field 5 or the records which has same value in Field 6

So my out put file should be

Code:

Field 1   field 2      field 3    Field 4    Field 5           Field 6
01        8305810257   19871020   051400727  8 561 8659/       85618659
01        8724011641   19870828   051400727  8 517 0534/       85170534
01        8724011641   19870828   051400727  85170534          85170534
01        8724011641   19870828   051400727  651705-35         65170535
01        8724011641   19870828   051400727  6517/05-35        65170535
01        8724011641   19870828   051400727  6517053/5         65170535


Can anybody help me in writing a program to arrive at the above logic.Can i get the req ouput by any sort tool
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: Sat Jan 20, 2007 10:03 pm    Post subject:
Reply with quote

Quote:
My output file should contain only records which has non-numeric value in Field 5 or the records which has same value in Field 6


It's not clear what you mean by this. What is the length of field5 and field6? What do you consider to be a "non-numeric"? Some of the fields have embedded blanks, some have / and -, some have trailing blanks. What are the "rules" for determining if the field is "non-numeric"? Is 11111 a "non-numeric" because it has trailing blanks?

You say the output field should contain records which have the same value in Field 5 and Field6. The fourth record meets that criteria, but you don't show it in your output example. Why? Actually all of your values have the same digits in field5 and field6, so do the fields have to match exactly (85170535 and 85170535) or can just the digits match (8 561 8659/ and 85618659)?

Before anyone can help you, you need to do a much better job of explaining the "rules" you want to use for including records, and you need to show a better example of input and output. Also, what is the RECFM and LRECL of your input file?
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: Sun Jan 21, 2007 7:56 am    Post subject:
Reply with quote

Hello,

Quote:
Can anybody help me in writing a program to arrive at the above logic.Can i get the req ouput by any sort tool


In COBOL you could use
Code:
IF FIELD-5 NOT NUMERIC OR
  (FIELD-5 IS NUMERIC AND
    FIELD-5 = FIELD-6)
   WRITE THE-OUTPUT.
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: Sun Jan 21, 2007 9:46 pm    Post subject:
Reply with quote

Dick,

A DFSORT INCLUDE statement can be used for the same logic, but please see my post above asking for clarification as to what is really needed here.

BTW, does COBOL's "NOT NUMERIC" treat 1111 with trailing blanks as not numeric or numeric?
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: Mon Jan 22, 2007 4:35 am    Post subject:
Reply with quote

Hi Frank,

I probably should have waited for TS to post more info, but figured that if the problem was being worked over the weekend and a few lines of COBOL might help, i'd post them. I made the mistake of believing that the data was not a good sample and under-coded coded accordingly icon_redface.gif .

To answer your question, '1111 ' will test not numeric - i made up this little test to demonstrate a few situations and:
Code:
   01  SOMESTUFF.                     
     05 A PIC X(7) VALUE '1111   '. 
     05 B PIC X(7) VALUE '1 11111'. 
     05 C PIC X(7) VALUE '1111111'. 
     05 D PIC X(7) VALUE '111111A'. 
     05 E PIC X(7) VALUE '   1111'. 
     05 F PIC X(7) VALUE '       '. 
 
 IF A NOT NUMERIC DISPLAY 'A NOT NUMERIC ' A.   
 IF B NOT NUMERIC DISPLAY 'B NOT NUMERIC ' B.   
 IF C NOT NUMERIC DISPLAY 'C NOT NUMERIC ' C.   
 IF D NOT NUMERIC DISPLAY 'D NOT NUMERIC ' D.   
 IF E NOT NUMERIC DISPLAY 'E NOT NUMERIC ' E.   
 IF F NOT NUMERIC DISPLAY 'F NOT NUMERIC ' F.   

returns:
Code:
A NOT NUMERIC 1111                   
B NOT NUMERIC 1 11111                 
D NOT NUMERIC 111111A                 
E NOT NUMERIC    1111                 
F NOT NUMERIC                         


If the data will contain leading/trailing spaces along with the digits, my example won't work as coded. If there might be a zoned decimal in the input, my little code will reject that as well. . . To handle the ZD or the leading/trailing spaces additional code would be needed in the COBOL program. Depending on what should happen with all spaces, other code would be required also (i.e. is that zero or not numeric?).
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 Jan 22, 2007 9:38 pm    Post subject:
Reply with quote

Dick,

I'm going to wait for Abi to post a clearer explanation and example before I show how to do it with DFSORT. I just don't have a clear idea of what's wanted at this point.
Back to top
View user's profile Send private message
Abi

New User


Joined: 27 Jul 2005
Posts: 35
Location: Chennai

PostPosted: Thu Feb 01, 2007 2:51 pm    Post subject:
Reply with quote

Hi,

Field 5 and field 6 are X(25) and i consider field 5 as non-numeirc if it has special characters or embedded spaces or combination of both

I have 2 rules for the records to be written into output file.

My First rule is if the filed 6 of 1st & 2nd record are equal then i need both the records to be written into output file.

My Second rule is If field 5 has embedded spaces or special characters...then i need that record in the output file.
Code:

Code:
Field 1   field 2      field 3    Field 4    Field 5           Field 6
01        8305810257   19871020   051400727  8 561 8659/       85618659
01        8724011641   19870828   051400727  8 517 0534/       85170534
01        8724011641   19870828   051400727  85170534          85170534
01        8724011641   19870828   051400727  85170535          85170535
01        8724011641   19870828   051400727  123456             123456
01        8724011641   19870828   051400727  651705-35         65170535
01        8724011641   19870828   051400727  6517/05-35        65170535
01        8724011641   19870828   051400727  6517053/5         65170535
01        8724011641   19870828   051400727  11111               11111

In the above input file
1st record has embedded spaces & a slash in field 5 so i need this reocrd in my out file
2nd and 3 rd record has same value in field 6.so i need this both record in out file.

6,7 & 8th record has same value in field 6.so i need all this record in out
file.

4,5& 9th record don't have special characters in field 5 and also it don't have any other records which has equal value in field 6.so these shld not be there in the input file.

my output file shld be

Code:
Field 1   field 2      field 3    Field 4    Field 5           Field 6
01        8305810257   19871020   051400727  8 561 8659/       85618659
01        8724011641   19870828   051400727  8 517 0534/       85170534
01        8724011641   19870828   051400727  85170534          85170534
01        8724011641   19870828   051400727  651705-35         65170535
01        8724011641   19870828   051400727  6517/05-35        65170535
01        8724011641   19870828   051400727  6517053/5         65170535



Actual LRECL of the fle is 178 and record format is FB.

I have wrritten a cobol pgm to accomplish this. I just wanted to know whether can we do it by DFSORT ?

Thanks
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: Fri Feb 02, 2007 12:47 am    Post subject:
Reply with quote

Here's a DFSORT/ICETOOL job that will do what I think you asked for.

I don't know the LRECL of your input file or the starting positions of the fields, so I assumed that your input file has LRECL=80, field 5 is in positions 46-57 and field 6 is in positions 64-75. You can change the job appropriately for your real LRECL and positions.

You'll need z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) in order to use DFSORT's SQZ function. If you don't have the April, 2006 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 PTF, see:

www.ibm.com/servers/storage/support/software/sort/mvs/peug/


Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=...  input file
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file
//TOOLIN DD *
SELECT FROM(IN) TO(T1) ON(64,16,CH) ALLDUPS DISCARD(T2) USING(CTL1)
COPY FROM(T2) TO(T1) USING(CTL2)
SORT FROM(T1) TO(OUT) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(81:SEQNUM,8,ZD)
/*
//CTL2CNTL DD *
  INREC IFTHEN=(WHEN=INIT,
     OVERLAY=(89:46,12,SQZ=(SHIFT=RIGHT,MID=C'*')))
  OUTFIL FNAMES=T1,
    INCLUDE=(89,1,SS,NE,C' 0123456789',OR,
             90,1,SS,NE,C' 0123456789',OR,
             91,1,SS,NE,C' 0123456789',OR,
             92,1,SS,NE,C' 0123456789',OR,
             93,1,SS,NE,C' 0123456789',OR,
             94,1,SS,NE,C' 0123456789',OR,
             95,1,SS,NE,C' 0123456789',OR,
             96,1,SS,NE,C' 0123456789',OR,
             97,1,SS,NE,C' 0123456789',OR,
             98,1,SS,NE,C' 0123456789',OR,
             99,1,SS,NE,C' 0123456789',OR,
            100,1,SS,NE,C' 0123456789'),
    BUILD=(1,88)
/*
//CTL3CNTL DD *
  SORT FIELDS=(81,8,ZD,A)
  OUTREC BUILD=(1,80)
/*
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 sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts JOINKEYS Paired and Unpaired Sort MFwhiz DFSORT/ICETOOL 4 Fri Sep 29, 2017 1:48 am
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am

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