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
 

 

Help on SORT Logic.
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
apandey

New User


Joined: 31 Aug 2009
Posts: 73
Location: Mumbai

PostPosted: Wed Mar 21, 2012 2:13 pm    Post subject: Help on SORT Logic.
Reply with quote

Hi
I have a input fie of 104 length file.

Code:
01  EMP-REC.                                             
     10 EMP-KEY                         PIC X(10).       
     10 EMP-NAME                        PIC X(30).       
     10 EMP-DESIGN.                                     
        49 EMP-DESIGN-LEN               PIC S9(4) COMP. 
        49 EMP-DESIGN-TEXT              PIC X(20).       
     10 EMP-ADDRESS.                                     
        49 EMP-ADDRESS-LEN              PIC S9(4) COMP. 
        49 EMP-ADDRESS-TEXT             PIC X(30).       
     10 EMP-SALARY                      PIC 9(10).       


I will be getting data in this format. But its not necessary that fields will contain full according to their length. Like Emp-key is of 10 byte but it can contain of 5 bytes data. So i need to write a sort card which will concatenate all fields in output file by '|' (pipe) and based on their data length output files' length must also vary. But it wont be greater than 104.
i.e
EMP-KEY(10)|EMP-NAME(30)|EMP-DESIGN-TEXT(20)|EMP-ADDRESS-TEXT(30)|EMP-SALARY

Also I hv to do vice-varsa.
I will be gettin file in above format of output file. So I need to write a sort card which will create file similart to the above input file containing LEN as well.
Back to top
View user's profile Send private message

prino

Active Member


Joined: 07 Feb 2009
Posts: 982
Location: Oostende, Belgium

PostPosted: Wed Mar 21, 2012 2:28 pm    Post subject:
Reply with quote

You are totally clueless, aren't you?

Is EMP-KEY is defined as PIC X(10), it will contain 10 bytes of data. No more, no less!
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7224

PostPosted: Wed Mar 21, 2012 2:32 pm    Post subject: Reply to: Help on SORT Logic.
Reply with quote

What is in the "trailing" part of each field you want to chop? Do you have embedded spaces in names, or anything?

On the way "out" are you ignoring the binary fields, or would you prefer to use them to determine the lengths?

On the way "in" would you like the binary fields to be correct, or zero?

EDIT: We can assume that you meant "n bytes of data and 10-n bytes of "stuff" that you don't want on the Pipe file, but which you realise is convenient to have normally".
Back to top
View user's profile Send private message
apandey

New User


Joined: 31 Aug 2009
Posts: 73
Location: Mumbai

PostPosted: Wed Mar 21, 2012 2:44 pm    Post subject:
Reply with quote

Hi Prino,

I mean,
If EMP-KEY(10) will contain 5 bytes data+5 trailing spaces then i want to ignore them and just want to concatenate 5 bytes of actual data.

Bill, I dont want to write binary fields in output but yes how it can be used in sort so that actual data(not trailing spaces) can be incuded in output.

Similary when i will receive a file which will contain '|' then at tht time i need to write the binary fields also in output which will contain the length.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Wed Mar 21, 2012 3:03 pm    Post subject:
Reply with quote

Ashutosh,
if the field length is zero, assume you want the data value expressed as ||


Forum Members,
word to the wise,
this poster has a habit of starting threads and then never coming back.
Back to top
View user's profile Send private message
apandey

New User


Joined: 31 Aug 2009
Posts: 73
Location: Mumbai

PostPosted: Wed Mar 21, 2012 3:10 pm    Post subject:
Reply with quote

Hi Dick
Yes if the fields length will be zero then data value will be ||.

But Sorry
I didnt get you.. If you have provided a solution for a topic started by me and if it worked for me then what is point in coming back.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7224

PostPosted: Wed Mar 21, 2012 3:20 pm    Post subject:
Reply with quote

apandey wrote:
[...]
But Sorry
I didnt get you.. If you have provided a solution for a topic started by me and if it worked for me then what is point in coming back.


Politeness, grace, good manners, information (knowing the solution works), feelings of warmth to the whole of humanity... etc
Back to top
View user's profile Send private message
apandey

New User


Joined: 31 Aug 2009
Posts: 73
Location: Mumbai

PostPosted: Wed Mar 21, 2012 3:29 pm    Post subject:
Reply with quote

I hope i hv done tht Bill...if you remeber my last post in cobol section few days back...!
And If you guys still think so, then sorry for tht. Will keep in mind. Thanks for informing icon_smile.gif

But I am still not able to sort out my issue.
I am not able to find the solution coz of Length.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7224

PostPosted: Wed Mar 21, 2012 3:33 pm    Post subject: Reply to: Help on SORT Logic.
Reply with quote

It was you who said "what is the point"? :-)

I just answered, I didn't check through your posting history, since you were so unconcerned about it....
Back to top
View user's profile Send private message
apandey

New User


Joined: 31 Aug 2009
Posts: 73
Location: Mumbai

PostPosted: Wed Mar 21, 2012 3:56 pm    Post subject: Reply to: Help on SORT Logic.
Reply with quote

Hi All

I have tried thru OUTREC giving C'|' in it but file is coming as fixed block and with spaces as below:
Code:
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6---
****** ***************************** Top of Data *********************
000001 100       |RAHUL KUMAR                   |IT ANALYST          |
000002 15489     |JOHN SMIT                     |PROJECT MANAGER     |
000003 366537    |BIMAL ROY SEN                 |SOFTWARE DEVELOPER  |
****** **************************** Bottom of Data *******************
                                                                     


Is there any way thru which the Trailing spaces can be removed thru SORT.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7224

PostPosted: Wed Mar 21, 2012 4:05 pm    Post subject: Reply to: Help on SORT Logic.
Reply with quote

You would need to put "something" around the fields which can contain embedded blanks, and SQZ the record checking on the processing of QUOTE/APOST. Then convert it to variable-length.

Watch out for the possibility of your delimeter appearing in your data. Maybe to FINDREP to something like X'FF' and then reverse it after the SQZ.

The binary fields on the way back are trickier. It would be best to use the binary fields on the way out, but I'm not sure how :-)
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Wed Mar 21, 2012 4:05 pm    Post subject:
Reply with quote

Ashutosh,

you spend a lot of time (and space) defending yourself,
but you never supply any of the info asked for.

and what i was referring to was threads started by you,
questions asked in order to create a solution for you,
that you never answer, and the thread dies.

but i digress,

you want:
EMP-KEY(10)|EMP-NAME(30)|EMP-DESIGN-TEXT(20)|EMP-ADDRESS-TEXT(30)|EMP-SALARY
but spaces on the right truncated?
EMP-SALARY will always be 10 char numeric?
will this be generated as a Variable record file or Fixed length (104) record file?


as well as the converse?

again, answer the question of variable length and/or fixed length.

EMP-KEY|EMP-NAME|EMP-DESIGN-TEXT|EMP-ADDRESS-TEXT|EMP-SALARY
EMP-KEY expanded to 10
EMP-NAME expanded to 30
EMP-DESIGN-LEN generated as 2 bytes binary reflecting the length of data between the two | bounding EMP-DESIGN-TEXT
EMP-DESIGN-TEXT expanded to 20
EMP-ADDRESS-LEN generated as 2 bytes binary reflecting the length of data between the two | bounding EMP-ADDRESS-TEXT
EMP-ADDRESS-TEXT expanded to 30
EMP-SALARY copied as the 10 char

and this is to be generated as a 104 byte record
Back to top
View user's profile Send private message
apandey

New User


Joined: 31 Aug 2009
Posts: 73
Location: Mumbai

PostPosted: Wed Mar 21, 2012 4:29 pm    Post subject:
Reply with quote

Bill, Sorry I dont know abt SQZ icon_sad.gif

Dick,
As mentioned by you, yes I need my output as:
EMP-KEY(10)|EMP-NAME(30)|EMP-DESIGN-TEXT(20)|EMP-ADDRESS-TEXT(30)|EMP-SALARY
But the fields shudn't contain trailing spaces.
YES, EMP-SALARY will always contain 10 digit numeric data.
Output File can be created in VB with 104 length.
Say if all fields contain full data without spaces then whole 104 lenth would be full. If all length fields data without spaces + 4 pipes(|) is less than 104 then remaining positions after last field(EMP-SALARY) can be filled with spaces.

While for Vice versa
It will be other way round.
Either a field contains spaces or not it shud be included till its exact length.
Ex. EMP-KEY(10) contains 5 bytes data but next field shud be written from 11th position.
LEN field will contain the length of field containing actual data without spaces. EMP-ADDRESS-TEXT(30) contains 15 bytes data then LEN will be 15.
RECFM will be FB with LRECL of 104.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7224

PostPosted: Wed Mar 21, 2012 4:34 pm    Post subject: Reply to: Help on SORT Logic.
Reply with quote

Link to the manuals at the top of the page.
Back to top
View user's profile Send private message
Nikhil Jain

New User


Joined: 20 Jul 2011
Posts: 16
Location: India

PostPosted: Wed Mar 21, 2012 4:57 pm    Post subject: Reply to: Help on SORT Logic.
Reply with quote

While, you are rading the manual, you might want to have a look at the PARSE also.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Wed Mar 21, 2012 5:06 pm    Post subject:
Reply with quote

Quote:
Output File can be created in VB with 104 length.
Say if all fields contain full data without spaces then whole 104 lenth would be full. If all length fields data without spaces + 4 pipes(|) is less than 104 then remaining positions after last field(EMP-SALARY) can be filled with spaces.


that means you want a fixed length output.....................................................
Back to top
View user's profile Send private message
charanmsrit

New User


Joined: 25 Oct 2007
Posts: 80
Location: Australia

PostPosted: Wed Mar 21, 2012 5:27 pm    Post subject:
Reply with quote

Ashutosh,

have a look at smart DFSORT tricks document. Refer to "deconstrcut and reconstruct CSV records" section. it is a very good starting point for your requirement.

ftp://ftp.software.ibm.com/storage/dfsort/mvs/sorttrck.pdf

Regards,
Charan
Back to top
View user's profile Send private message
apandey

New User


Joined: 31 Aug 2009
Posts: 73
Location: Mumbai

PostPosted: Wed Mar 21, 2012 5:51 pm    Post subject:
Reply with quote

Hi Charan
Sorry above link is not working 'Internet Explorer cannot display the webpage' is the msg i am getting. I think it is blocked here.

Yes Dick, it will be FB file.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7224

PostPosted: Wed Mar 21, 2012 6:03 pm    Post subject: Reply to: Help on SORT Logic.
Reply with quote

If you can access this site, maybe you might think the "ftp" bit is tripping you up?

How about google? DFSORT Manuals got me this.

You are making things hard for yourself by not doing much to help yourself. Also search this forum, you'll find lots of SQZ and PARSE and JUSTIFY and stuff.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7224

PostPosted: Wed Mar 21, 2012 6:13 pm    Post subject: Reply to: Help on SORT Logic.
Reply with quote

There's even a link from a STICKY at the top of each page of the DFSORT forum where you have posted.
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
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
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 Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


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